himera icon indicating copy to clipboard operation
himera copied to clipboard

infinite lazy seqs don't work

Open ulsa opened this issue 13 years ago • 5 comments

Tried this, but it hangs:

(def all-ints (iterate inc 0))

ulsa avatar Apr 27 '12 11:04 ulsa

They work, but the problem here is that the REPL attempts to print them. Thank you for the reminder.

fogus avatar Apr 27 '12 13:04 fogus

Workaround:

(do (def all-ints (iterate inc 0)) nil)

Or:

(defn forget [_] nil))
(forget (def all-ints (iterate inc 0)))

bernieblume avatar Jun 10 '12 19:06 bernieblume

Nice trick. Thanks.

ulsa avatar Jun 10 '12 21:06 ulsa

An update to ClojureScript is coming out that will allow this. :def-emits-var true needs to be put in the compiler env. See http://dev.clojure.org/jira/browse/CLJS-934

mfikes avatar Jul 01 '15 18:07 mfikes

Cool stuff! CLJS is maturing more and more!

bernieblume avatar Jul 01 '15 23:07 bernieblume