Limiting *print-length* keeps the OutOfMemoryError away, but I guess
it would leave me - when testing more complicated and obscure
functions - insecure whether the returned sequence really is a lazy
one or will blow up the memory instead. But good to know anyway ...
I guess the println function is
On Sat, Jul 30, 2011 at 2:25 PM, Ben wrote:
> Hi,
>
> I'm new in the community and new to Clojure and both a really great. A
> big thanks to Rich Hickey and everyone else involved.
>
> I have a question that refers to an example Stuart Halloway used in
> "Programming Clojure". There he defines the
Ben writes:
> (defn whole-numbers [] (iterate inc 1))
>
> If I use it like this at the REPL
>
> (take (whole-numbers))
>
> I get:
> Java heap space [Thrown class java.lang.OutOfMemoryError]
>
> This unexpectedly is the same result that I expectedly get when
> binding whole-numbers to a t
When I do that, the REPL starts printing the sequence, filling screens
after screens with numbers.
By doing that, it realizes the printed part of the sequence, which
will eventually lead to an OOM error, since it probably holds on to
the reference to the start of the sequence.
Doing (set! clojure.
Hi,
I'm new in the community and new to Clojure and both a really great. A
big thanks to Rich Hickey and everyone else involved.
I have a question that refers to an example Stuart Halloway used in
"Programming Clojure". There he defines the whole numbers as fn:
(defn whole-numbers [] (iterate in