On Wed, Jul 8, 2009 at 3:42 AM, Frantisek Sodomka <fsodo...@gmail.com>wrote:

>
> If result is a vector v, then from these 4 cases:
> (let [v [1 2 3]]
>  (let [[a b c] v] a b c)
>  (let [a (v 0) b (v 1) c (v 2)] a b c)
>  (let [a (nth v 0) b (nth v 1) c (nth v 2)] a b c)
>  (let [x (first v) r1 (rest v) y (first r1) r2 (rest r1) z (first
> r2)] x y z))
>
> using 'nth'
> (let [a (nth v 0) b (nth v 1) c (nth v 2)] a b c)
> is the fastest.
>

Is it faster than using list and manually destructuring the list?

If so, that would mean that (nth v n) is faster than (get v n), which would
be odd since the latter should turn into the former anyway and be inlinable
by the JIT.

--~--~---------~--~----~------------~-------~--~----~
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