On Sat, Aug 7, 2010 at 9:30 PM, David Cabana <drcab...@gmail.com> wrote:

> conj is not the same as append; it will insert the new element in the
> smart (most efficient) way. For instance:
> user> (conj  '(1 2 3) 0)
> (0 1 2 3)
> user> (conj [1 2 3] 0)
> [1 2 3 0]
>
> There is no performance hit from using conj to insert at the end of a vector.
Interesting to know. Just curious which one is more efficient(not that
I question the vector append is slow) as it would still involve some
array copy and creation(though I assume it would be very efficient as
it is using the very low level i.e. sort of memcpy) whereas the
single-link-list cons would always be O(1).

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to