On Mon, Mar 2, 2009 at 8:45 PM, MikeM <michael.messini...@invista.com> wrote: > >> At the end of the Vectors section I say this: >> "All the code examples provided above for lists also work for vectors." >> >> Do you think I should provide more detail than that? > > I missed that sentence. I think it's helpful to know that some > functions return a list type when given a vector, others will maintain > the vector type. This can be important for performance of subsequent > operations.
The only function I could find that takes a vector and returns a list instead of a vector or a sequence is the reverse function. Are there others? >> > Also, you mention that vectors are "not efficient when new items need >> > to be added or removed quickly", but subvec should perhaps be >> > mentioned as an exception. >> >> Can you elaborate on that? You might be teaching me something new. >> > If I understand correctly, subvec creates a new object that shares > elements with the original vector with no copying. subvec can't be used to remove items from the middle of a vector. That's what I was going for even though I didn't state it very clearly. The latest version of the article says the following about vectors: "They are ideal when new items will be added to or removed from the back (constant-time). They are efficient (constant time) for finding (using nth) or changing (using assoc) items by index." I added a sentence to the discussion about subvec to say that it shares structure with the original. -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---