Hi,

Am 15.11.2010 um 23:07 schrieb Ken Wesson:

> (loop [s some-coll o nil]
>  (if (empty? s)
>    o
>    (let [f (first s)]
>       (blah blah blah s blah blah blah f blah blah blah)
>       (recur (rest s) (conj o foobar)))))
> 
> or some similar control flow structure, where s gets first and rest
> used on it, but not (directly) seq. If some-coll is not already a seq,
> using these implicitly generates a seq view of it with seq; on every
> iteration but the first, s is bound to a seq implementation already.

Changing the above code to the following (which is similarly readable) should 
give an immediate speed bump. Rich once stated something around 20%, although I 
have not verified the numbers and this was quite a while ago...

(loop [s (seq some-coll)
       o nil]
  (if s
    (let [f (first s)]
      (bla bla bla f bla bla bla)
      (recur (next s) (conj o foobar)))
    o))

Sincerely
Meikel

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