[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tail recursion (was Re: a (revised) draft of R5RS)




It is certainly a good thing to try making the notion of "proper
tail-recursiveness" more precise.  But while you guys are at it you
might also consider a few corners of the language where it isn't
obvious from the way things are currently defined whether or not calls
are in tail-position.

Especially the higher-order variety of built-in primitives is
troublesome:

- Is the call to f in (apply f '(1 2 3)) a tail-call?
- Is the call to f in (for-each (lambda (x) (if x (f x) 0)) '(#f 1)) a
  tail-call?
- Is the call to f in (eval '(f 1) env) a tail-call?
- Is the call to f in (call-with-current-continuation f) a tail-call?

In VSCM, for example, the answer to all these questions is yes, but I
can see why other implementations might behave differently.

Regards,
-Matthias