On May 15, 2009, at 3:36 PM, Vagif Verdi wrote:

It looks to me like vectors almost completely overtake lists for all purposes.

I think that's a fair statement.

Lists are still:

- key as the data structure that represents a "call" (to a function, macro, or special form)

- useful for cases where you want to add/remove something to/from the beginning of a collection efficiently

- more efficient than vectors (to a degree that may or may not matter) for use as a stack via conj and pop [1]

Regarding quoted lists, Rich had this to say [2]:

Or better yet, just use a vector, please. It's more idiomatic Clojure

(doseq [word ["one" "two" "three"]]
  (println word))

Quoted lists are an ugly part of Lisps that can be avoided in Clojure.
I don't see a lot of use for them other than in macros and other
code-producing code.


Another nice benefit of Clojure's efficient vectors over lists is that functions that produce a collection of results can produce and store them in order without needing to "reverse" the result just before returning. Reversing is a common operation in some other Lisps and a rare one in Clojure.

--Steve

[1] From David's reply in this thread.
[2] http://groups.google.com/group/clojure/msg/1fb853de29dc1bd7

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to