On Tue, Dec 21, 2010 at 12:08 PM, Andrew Boekhoff <boekho...@gmail.com>wrote:

> > With TCO mutually recursive functions do not consume the stack. The same
> is
> > true for well constructed lazy sequences.
>
> If the functions were:
> (defn f [x] (g x))
> (defn g [x] (f x))
>
> They would operate in constant space with tail-call optimization.
>
> (defn f [x] (cons x (g x)))
> (defn g [x] (cons x (f x)))
>
> Will run out of memory even in languages that support
> tail call optimization.
> (assuming we're evaluating them eagerly)
>
> Lazy-seq's are often handy in Clojure to subvert the stack limit imposed
> by the the JVM, but it's not quite the same problem that TCO solves.


Having recently converted some Scheme that leaned heavily on the presence of
TCO, I'm curious as to what situations you think could not be solved with
lazy-seqs?

David

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