Hi,

in the first example the recursion happens immediately. That is when you 
call my-map you get start the recursion immediately all the way down. Hence 
you get the overflow. With lazy-seq basically nothing is done when calling 
my-map. The computation is deferred. Only when accessed the computation is 
done and then only one step, because the recursive call to my-map again 
defers any computation. The your call stack is always only one function 
deep. Instead of the 1million frames in the first version.

Hope this helps.

Kind regards
Meikel

-- 
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

Reply via email to