help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lists and Vectors


From: David Kastrup
Subject: Re: Lists and Vectors
Date: Fri, 09 Oct 2009 12:44:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Nordlöw <per.nordlow@gmail.com> writes:

> If I have an association list say,
>
> '(
>   ("key" sym1 val1 num1)
>   ("key2" sym2 val2 num2)
> )
>
> , where each entry is a fixed sequence of various objects. I might
> aswell use a vector to represent an entry in this alist, right?
>
> In this case, what do I gain by using a vector instead of list?

conses.

> What about performance?: aref() faster than nth() only for large
> vectors?

Mostly.

> Is there vector-variant of assoc()? If not, why? Has any one already
> written such a function?

You would only put sym, val, num into the vector.  If your association
list is long enough that key lookup would become slow, you'd rather use
a hashtable.

-- 
David Kastrup


reply via email to

[Prev in Thread] Current Thread [Next in Thread]