[plt-scheme] a few questions (was: Scheme questions?)

From: Bill Wood (william.wood3 at comcast.net)
Date: Mon Dec 5 21:26:16 EST 2005

On Mon, 2005-12-05 at 14:53 -0600, John David Stone wrote:
   . . .
> About this form, the authors say, ``We have decided not to use the
> traditional LABEL primitive in this interpreter because it is difficult to
> define several mutually recursive functions using only LABEL.  The
> solution, which Hewitt [Smith and Hewitt] also uses, is to adopt an
> ALGOLesque block syntax.''

Interestingly enough, this was already foreshadowed in Lisp 1.5.  The
Lisp 1.5 Programmer's Manual, 2nd ed., MIT Press, 1965 has this to say
on p.18:

   When a function is recursive, it must be given a name.  This is
   done by means of the form LABEL, which pairs the name with the
   function definition on the a-list.  The name is then bound to the
   function definition, just as a variable is bound to its value.

      In actual practice, LABEL is seldom used.  It is usually more
   convenient to attach the name to the definition in a uniform
   manner.  This is done by putting on the property list of the name,
   the symbol EXPR followed by the function definition.  The pseudo-
   function "define" used at the beginning of this section
   accomplishes this.  When "apply" interprets a function represented
   by an atomic symbol, it searches the p-list of the atomic symbol
   before searching the current a-list.  Thus a "define" will override
   a LABEL.

(The "a-list" referred to was an association list used for the binding
environment.)

That last statement is very interesting.  It would seem that,
theoretically, the LABEL form binds the name; that is, a form
  (LABEL foo (lambda (...) (... foo ...)))
should be equal to the form
  (LABEL bar (lambda (...) (... bar ...)))
and hence the bound name should be insulated from collision with names
in outer contexts.  The last sentence, however, belies that.

My guess is that once LABEL and "define" were both available, LABEL was
quickly driven out due to mutual incompatibility.

I guess even dedicated lispers never had a significant need for
anonymous recursive functions

 -- Bill Wood


  
   



Posted on the users mailing list.