On Thu, Jan 20, 2011 at 10:30 PM, gaz jones <gareth.e.jo...@gmail.com> wrote:
> interesting... the changes i suggested cause it to get the first 3
> values in around 300ms on my machine and dont blow the heap O_o

Yes; I'm not sure why but the lazy-seq version is significantly faster
than iterate, though the latter is interesting from a theoretical
functional-programming perspective.

All the boxing and unboxing (destructuring) on each iteration probably
account for the difference.

The iterate version, mind you, doesn't blow up if the finite input seq
with the smallest maximum value isn't also the first. :)

user=> (equal-values [[3 7 11] (range 5)])
(3#<BOOM! java.lang.NullPointerException>

(But the fix to that bug is easy to apply to both other versions and
doesn't appreciably slow them down.)

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