Laziness is pervasive in Haskell, for all computation (unless you force it off with special constructs).
Laziness in Clojure is as pervasive as sequences, but it is not for all computation like in Haskell, and sequences have the previously-mentioned features of sometimes-more-eager-than-the-minimum required. Self-referential lazy sequences are something I would recommend actively avoiding in Clojure, unless you want to live with buggy code, or dig into the implementation and convince yourself that you are within its behavior (which can change from version to version). Andy On Thu, Feb 12, 2015 at 4:21 PM, Jorge Marques Pelizzoni < jorge.pelizz...@gmail.com> wrote: > Neither did delay help: > > (defn primes [] (let [primes' (atom nil)] > (reset! primes' (delay (cons 2 (filter #(prime? (force ( > deref primes')) %) (drop 3 (range)))))))) > > > Serious this is not a bug? > > Em quinta-feira, 12 de fevereiro de 2015 22:14:46 UTC-2, Jorge Marques > Pelizzoni escreveu: >> >> Thanks, Michael, for your analysis and explanation. However not even this >> worked: >> >> (defn primes [] (let [primes' (atom nil)] >> (lazy-seq (reset! primes' (lazy-seq (cons 2 (lazy-seq >> (filter #(prime? (deref primes') %) (drop 3 (range)))))))))) >> >> >>>> -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.