On Mon, Nov 19, 2012 at 6:24 PM, Andy Fingerhut
<andy.finger...@gmail.com> wrote:
> Clojure's loop/recur only implements tail recursion, not general tail-call
> optimization.  tail recursion is far more commonly used in languages that
> have it than the general tail-call optimization to arbitrary functions.

Can you explain this? I'm assuming that "having tail recursion" here
means not "you can call yourself in tail position" but "calls to
yourself in tail position don't grow the stack". But I don't really
follow the second sentence, which seems to have two possible
continuations:

(a) tail recursion is far more commonly used in languages that have it
than the general tail-call optimization to arbitrary functions ... is
used in languages that have tail recursion.
(b) tail recursion is far more commonly used in languages that have it
than the general tail-call optimization to arbitrary functions ... is
used in languages that have *it* (i.e. general TCO).

But in (a), general tail-call optimization to arbitrary functions
couldn't be used very much in those languages; they don't have it. And
in (b), general TCO subsumes the optimization of tail recursion and
comes into play whenever a procedure is called from tail position, so
it would seem to be used pervasively in languages that have general
TCO.

-- 
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks,
which may be sweet, aromatic, fermented or spirit-based. ... Family
and social life also offer numerous other occasions to consume drinks
for pleasure." [Larousse, "Drink" entry]

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