On Dec 13, 7:56 pm, Stephen Compall <stephen.comp...@gmail.com> wrote: > On Tue, 2011-12-13 at 16:28 -0800, Alan Malloy wrote: > > As you can see, only as many elements are realized as are needed to > > satisfy the user's request. > > Yes, in the expression (conr (conr (conr '( 1 2 3) 4) 6) 7), all the > lazy-seqs implied by the conr calls must be forced immediately to yield > (1 . more). It is the same problem with repeatedly concatting to the > end, and with left-fold in a top-down evaluation scheme like Haskell: > you can run out of stack if you must travel deep to get to the first > element.
I see. You're making a subtler point than I realized, and you're right there. Repeated applications of conr need to be resolved all at once, but conr'ing one item onto an already-realized collection doesn't cause anything new to be realized until the element itself is needed. -- 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