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

Scheme Digest #293

  But HOW can it be done? I think the problem is to determine in every
  application of a compound procedure if it is the last command which is evaluated
  in a procedure. 

Another point of view is that the problem is to construct a framework in
which application does not require conditional treatment.  This can be
done.  The idea is that a procedure call *never* adds anything to the
stack; *all* calls, as such, are tail-recursive.  However, not all
*evaluations* are tail-recursive.  A frame must be added to the stack
whenever one is about to evaluate a function argument, or the predicate
part of a conditional, or any form except the last in a block, or in
general whenever one is about to evaluate a subform but must regain
control again.

For a more extensive treatment of this topic, see my paper "Procedure Call
Implementations Considered Harmful" in the Proceedings of the 1977 ACM
National Conference.

Happy hacking!

--Guy Steele