On Mon, May 3, 2010 at 7:42 PM, Heinz N. Gies <[email protected]> wrote: > > On May 3, 2010, at 20:20 , Stuart Halloway wrote: > >> Not all the way to a solution, but here is a trivial example that >> demonstrates the issue: >> >> (def x >> (loop [ct 0 >> s (lazy-seq)] >> (if (> ct 10000) >> s >> (recur (inc ct) (lazy-seq (filter identity s)))))) >> >> x >> => java.lang.StackOverflowError > > filter itself is a lazy seq, so if you have a filter and pass it on put a > (doall ) around it otherwise you'll have a filter in a filter in a filter ... > in a stack overlfow.
Ah, that's also why it only happens one out of twenty. I'll implement the doall trick and see how it goes. Thanks! > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- Anders Rune Jensen http://www.iola.dk -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
