On Wed, Dec 22, 2010 at 6:10 PM, Ken Wesson <kwess...@gmail.com> wrote:
> On Wed, Dec 22, 2010 at 6:08 PM, Chris Riddoch <riddo...@gmail.com> wrote: > > On Wed, Dec 22, 2010 at 3:46 PM, David Nolen <dnolen.li...@gmail.com> > wrote: > >> A entire collection of 5e7 *objects* is being realized into memory as it > is > >> being reduced down to a single value to be stored into a var. I would > expect > >> this to perform poorly in any language. > > > > Range doesn't return a lazy seq? Or reduce somehow doesn't work > > lazily? This is a little discouraging - it seems like this is a > > perfect example of a case where laziness could significantly improve > > things. > > No, both are lazy. Something else is going on here, involving def > holding onto the head of any sequence whose expression is in the def > form but not in a nested let or fn similar scope-creating form. http://groups.google.com/group/clojure?hl=en > reduce is not lazy. It is eager. chouser corrected me of my misconception. David -- 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