Re: lazy-seq and recursion.

2011-12-17 Thread Stephen Compall
On Fri, 2011-12-16 at 16:10 +0100, Tassilo Horn wrote: > A lazy seq is basically a sequence of the first element and a "thunk", > where a thunk is a function without parameters that knows how to > calculate the rest of the lazy sequence. When you call `rest' or `next' > on a lazy seq, that thunk i

Re: lazy-seq and recursion.

2011-12-17 Thread Narvius
Hey, I got myself a copy of The Joy of Clojure. It's a fascinating read, thanks for the recommendation! N. On Dec 16, 4:10 pm, Tassilo Horn wrote: > Narvius writes: > > Hi Narvius, > > > So, my question is, why exactly DOESN'T it crash and burn horribly > > with the cries of dying bits in the

Re: lazy-seq and recursion.

2011-12-16 Thread Tassilo Horn
Narvius writes: Hi Narvius, > So, my question is, why exactly DOESN'T it crash and burn horribly > with the cries of dying bits in the background? I suppose it has > something to do with how lazy-seqs work (another mystery for me). A lazy seq is basically a sequence of the first element and a "

lazy-seq and recursion.

2011-12-16 Thread Narvius
Hello, I just read some of the clojure.core source, and when reading map and range, I noticed that inside lazy-seq, recursion doesn't seem to stack overflow. I then tried it myself on some trivial examples, and indeed, I can take hundreds of thousands of entries from such a list without anything h