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

formal arguments to lambdas in Scheme



   Date: Sun, 19 Mar 89 18:26:01 est
   From: bal@hp-ny.ai.mit.edu (Brian A. LaMacchia)
   Reply-To: bal@zurich.ai.mit.edu
   Address: MacGregor E121, 450 Memorial Drive, Cambridge, MA 02139
   Phone: (617) 225-9210

   It turns out that the syntax

   (lambda (x . y) <foo>) 

   is defined in R^3RS (section 4.1.4, page 7).  However, a lambda is
   formally defined as being of the form 

   (lambda <formals> <body>)

   where <formals> has one of the following forms:

   1) (<var_1> ... ) the procedure takes a fixed number of args

   2) <var_1> the procedure takes any number of args, and <var_1> is bound
   to the list of args passed to the procedure

   3) (<var_1> ... <var_{n-1}> . <var_n>) where the first n-1 arguments are
   fixed and any remaining args are passed in a list to <var_n>.  

   In all of these cases, the {\it number} of formals is defined, as a
   lambda of the form 

   (lambda (x . y) <foo>)

   has exactly two formals.  The actual number of arguments which may be
   passed to the lambda is not known (except for a lower bound), but the
   formals are known.

   Please let me know if there's anything wrong with this.  Thanks.

					   --Brian LaMacchia
					     bal@zurich.ai.mit.edu
---------------------------------------
Sounds just right.

Regards, A.