On Tue, Nov 2, 2010 at 4:49 PM, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> Am 02.11.2010 um 12:58 schrieb Pepijn de Vos:
>
>> The one-liner:
>> http://gist.github.com/659491
>
> I would expect this is because you pile lazy seq on lazy seq, which then get 
> realised, unfolding the whole thing resulting in the stack overflow. Try this:

I'm sorry... I don't quite understand this explanation.  Do you mean
that reduce is realizing the entire list all at once?  I would think
it would grab an element one at a time.  Sorry for the stupid
question, but there's something subtle here that I'm not
understanding.

> user=> (reduce #(doall (map + %1 %2)) (partition 5 (range 1e6)))
> (99999500000 99999700000 99999900000 100000100000 100000300000)

Is it because of the way the lazy sequence is being generated?  Would
different implementations of partition or range do better?

Thanks in advance!

-John

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