Thanks, this explains the stack overflow
On Thursday, June 14, 2012 4:12:28 PM UTC+3, Dave Sann wrote:
>
> also
>
> (first (drop 10 (iterate #(doall (map inc %)) (range 10
>
> so the better answer is probably - because map is lazy
>
>
> On Thursday, 14 June 2012 23:06:27 UTC+10, Dave Sann
also
(first (drop 10 (iterate #(doall (map inc %)) (range 10
so the better answer is probably - because map is lazy
On Thursday, 14 June 2012 23:06:27 UTC+10, Dave Sann wrote:
>
> I suspect that the answer is the use of partial and the implementation of
> iterate
>
> with (comp vec...
I suspect that the answer is the use of partial and the implementation of
iterate
with (comp vec... you force realisation of the vector
without this I think you get (partial map (partial map (partial ) as f
is repeatedly applied
if you do this,
(first (drop 10 (iterate #(apply list (m
ah...but does for 1
On Thursday, 14 June 2012 22:58:58 UTC+10, Dave Sann wrote:
>
> It doesn't overflow for me.
>
>
> user=> (first (drop 1000 (iterate (partial map inc) (range 10
> (1000 1001 1002 1003 1004 1005 1006 1007 1008 1009)
>
>
> On Thursday, 14 June 2012 22:52:33 UTC+10, vmargi
It doesn't overflow for me.
user=> (first (drop 1000 (iterate (partial map inc) (range 10
(1000 1001 1002 1003 1004 1005 1006 1007 1008 1009)
On Thursday, 14 June 2012 22:52:33 UTC+10, vmargioulas wrote:
>
> Can someone explain why
> ... iterating over a sequence cause a stack overflow
>
Can someone explain why
... iterating over a sequence cause a stack overflow
(first (drop 1000 (iterate (partial map inc) (range 10 ->
java.lang.StackOverflowError
...but iterating over a vector works ok?
(first (drop 1000 (iterate (comp vec (partial map inc)) (range 10 -
> [1000 1001 1002