[31] formal-argument-list = required-formal-argument*
(#!optional optional-formal-argument*)?
(#!rest rest-formal-argument)?
(#!key keyword-formal-argument*)?
[32] required-formal-argument = variable
[33] optional-formal-argument = variable | ((variable initializer))
[34] rest-formal-argument = variable
[35] keyword-formal-argument = variable | ((variable initializer))
[36] initializer = expression
When the procedure is applied to a list of actual arguments,
the formal and actual arguments are processed from left to right
as follows:
| 1. Variables in required-formal-arguments are bound to
successive actual arguments starting with the first actual argument.
It shall be an error if there are fewer actual arguments than
required-formal-arguments. |
| 2. Next variables in optional-formal-arguments are bound to
remaining actual arguments.
If there are fewer remaining actual arguments than
optional-formal-arguments, then the variables are bound
to the result of evaluating initializer, if one was specified,
and otherwise to #f.
The initializer is evaluated in an environment in which
all previous formal arguments have been bound. |
| 3. If there is a rest-formal-argument, then it is bound to a list of
all remaining actual arguments. These remaining actual arguments are
also eligible to be bound to keyword-formal-arguments.
If there is no rest-formal-argument and there are no
keyword-formal-arguments, then it shall be an error if there
are any remaining actual arguments. |
| 4. If #!key was specified in the formal-argument-list, there shall be an even number of remaining
actual arguments. These are interpreted as a series of pairs, where
the first member of each pair is a keyword
specifying the argument name, and the second is
the corresponding value. It shall be an error if the first member of a
pair
is not a keyword. It shall be an error if the argument name is not the
same
as a variable in a keyword-formal-argument, unless there is a
rest-formal-argument.
If the same argument name occurs more than once in the list
of actual arguments, then the first value is used.
If there is no actual argument for a particular keyword-formal-argument,
then the variable is bound to the result of evaluating initializer
if one was specified, and otherwise to #f.
The initializer is evaluated in an environment in which
all previous formal arguments have been bound.
|
| Use of #!key in a formal-argument-list in
the transformation language or style language requires the
keyword feature. |
|
It shall be an error for a variable to appear more than once in a
formal-argument-list.
((lambda x x) 3 4 5 6) (3 4 5 6)
((lambda (x y #!rest z) z)
3 4 5 6) (5 6)
((lambda (x y #!optional z #!rest r #!key i (j 1)) (list x y z i: i j: j))
3 4 5 i: 6 i: 7) (3 4 5 i: 6 j: 1)
8.3.1.5 Conditional Expression
[37] conditional = (if
test
consequent
alternate)
[38] test = expression
[39] consequent = expression
[40] alternate = expression
A conditional is evaluated as follows: first,
test is evaluated. If it yields a true value,
then consequent is evaluated and
its value is returned. Otherwise, alternate is evaluated and its
value is returned.
(if (> 3 2) 'yes 'no) yes
(if (> 2 3) 'yes 'no) no
(if (> 3 2)
(- 3 2)
(+ 3 2)) 1