News for hackers. Stuff that matters.
Re:A Tour of Lisps by lispm on Tuesday January 30, 2024 @02:51AM (#39187421)
In Scheme:

    (define (foo)
      (bar))
the call to bar is a tail call. How does recur optimize this? Well, it doesn't, since "general TCO" / "full TCO" means that any tail call gets optimized, such that the stack does not grow. Clojure recur/loop is just a loop notation.

Looping construct in most languages provides a simple conversion of self recursion (a function calls itself recursively) to a loop: update the loop variables and then do the next loop iteration.

But the general case of tail calls is not covered by a simple local loop, like what is provided by Clojure.

There are no comments on this comment yet.