Hello Mark,

2010/8/10 Mark Engelberg <mark.engelb...@gmail.com>

> On Tue, Aug 10, 2010 at 1:15 AM, Nicolas Oury <nicolas.o...@gmail.com>
> wrote:
> >  So, in this particular case, Scheme does not warranty no exhaustion
> > of resources.
>
> Yes, but your recursion depth is limited to the length of the list you
> are processing.  So if you have enough resources to comfortably hold
> and manipulate the list in memory, odds are good you have enough
> resources to handle the non-tail recursive processing of the list.
>
> Generally speaking, I find I do not have to worry about "blowing the
> stack" in Scheme, and as a result, non-tail-call structural recursion
> (such as the algorithm that kicked off this thread) is perfectly
> idiomatic in the implementations of Scheme I have used (mostly
> Racket).


Naive question from someone who has not really used Scheme in practice :
beyond the memory footprint problem (which may or may not be a problem
depending on the memory size of an element in the initial list, and also
depending on whether you're recurring over a datastructure, or a presumably
very long lazy seq), isn't there an impact on CPU usage too ?


> In Clojure, I find stack limitations are a real issue unless
> I transform the algorithms into a tail-recursive accumulator style.
> For lists, it's usually not hard.  For trees, it can be a bit of a
> pain.
>

oh yes :-)


>
> Since Clojure has a lot of similarities with Scheme, this is a key
> difference that needs to be emphasized to people coming from Scheme or
> using a Scheme-based textbook to try to learn Clojure.
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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