[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: requiring proper tail recursion
Date: Mon, 2 Jun 97 14:31:50 -0700
From: Morry Katz <katz@quilty.Stanford.EDU>
Cc: email@example.com, firstname.lastname@example.org, email@example.com,
firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
Subject: requiring proper tail recursion
I find this paragraph difficult to read. As such, I feel that those
who are less knowledgable will find it opaque. Might I suggest
something like the following? the second sentence is still too
unwieldy for a final product, but I think the following version is a
little easier to understand.
Implementations of Scheme are required to be properly
tail-recursive. Any procedure applications appearing in another
procedure having the property that whatever value is returned by
the applied procedure will in turn be returned by the procedure in
which the application appears is said to be in a tail position.
The important feature of procedure applications in tail position
is that the stack frame for the calling procedure is unneeded once
the call has been made. An implementation is said to be properly
tail-recursive if it in effect arranges for the result of a
tail position call to be returned directly to the continuation
that was passed to the procedure that contains the tail position
call, instead of being returned to the calling procedure.
Proper tail-recursion allows iteration to be efficiently
expressed using ordinary procedure-call mechanics. Special
iteration constructs become useful only as syntactic sugar.
Unfortunately, the second sentence is not merely unwieldy, but wrong.
That the value returned be the same is too strong a condition for