On 28 January 2010 14:16, timc <timgcl...@gmail.com> wrote:
> The last, elegant one works -- marvellous!
>
> Thanks a lot.

Great! You're welcome. :-)

However, the original "less elegant" version with the fix I proposed
alongside the reduce-based version is actually better. (Which I've
only noticed after posting it -- sorry for the confusion.)

I believe both to be fully lazy in terms of their approach to file IO,
however the reduce based version overflows the stack eventually (with
the list of sources exceeding 2080 items in length with my setup),
whereas the fixed original does just fine for 50000 sources (and could
go on forever, as read-lines is good enough to close its reader once
it's done reading from it).

2080 items seems like a lot, but there's lots of good uses for
stack-using recursion, so it's best to avoid it where it's possible at
a low cost.

Sincerely,
Michal

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