There are several forms in XLISP that require that a
The lambda list starts with 'required' arguments. Required arguments must be specified in every call to the function.
The 'required' arguments are followed by the &optional arguments. Optional arguments may be provided or omitted in a call. An initialization expression may be specified to provide a default value for an &optional argument if it is omitted from a call. If no initialization expression is specified, an omitted argument is initialized to NIL.
It is also possible to provide the name of a 'supplied-p' variable that can be used to determine if a call provided a value for the argument or if the initialization expression was used. If specified, the 'supplied-p' variable will be bound to T if a value was specified in the call and NIL if the default value was used.
The &optional arguments are followed by the &rest argument. The &rest argument gets bound to the remainder of the argument list after the required and &optional arguments have been removed.
The &rest argument is
followed by the &key
arguments. When a keyword argument is passed to a function, a pair of values
appears in the argument list. The first expression in the pair should
evaluate to a keyword symbol [a symbol that begins with a
Like &optional arguments, &key arguments can have initialization expressions and 'supplied-p' variables. In addition, it is possible to specify the keyword to be used in a function call. If no keyword is specified, the keyword obtained by adding a colon ':' to the beginning of the keyword argument symbol is used.
In other words, if the keyword argument symbol is:
foo
the keyword will be:
:foo
The &key arguments are followed by the &aux variables. These are local variables that are bound during the evaluation of the function body. It is possible to have initialization expressions for the &aux variables.
Here is the complete syntax for lambda lists:
where:
is a required argument symbol | ||
is an &optional argument symbol | ||
is the &rest argument symbol | ||
is a &key argument symbol | ||
is a keyword symbol | ||
is an auxiliary variable symbol | ||
is an initialization expression | ||
is a supplied-p variable symbol |