[plt-scheme] begin0 and tail recursion

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Jul 20 11:13:22 EDT 2003

At Sun, 20 Jul 2003 17:10:20 +0200 (MEST), Stefan Ottosson wrote:
> On Sun, 20 Jul 2003, Robby Findler wrote:
> > It isn't a tail call because it must evaluate E1, then evaluate E2, and
> > then return E1's result.
> Ok, so I was being naive then. Hmm.. I guess there's just no way to do
> something like pop a stack after the tail call, but still return the value
> of the tail call, without turning it into a recursive process?

Worst comes to worst, you can use CPS, but then you're really managing
your own stack on the side and it's a whole program change.

In the code you sent, the second argument to begin0 was just a symbol,
so you can just delete it without changing the program's behavior, I
believe (well, you'll only see the difference with wcm).


Posted on the users mailing list.