Next: Getopt Parameter lists, Previous: Command Line, Up: Programs and Arguments [Contents][Index]
Arguments to procedures in scheme are distinguished from each other by their position in the procedure call. This can be confusing when a procedure takes many arguments, many of which are not often used.
A parameter-list is a way of passing named information to a procedure. Procedures are also defined to set unused parameters to default values, check parameters, and combine parameter lists.
A parameter has the form (parameter-name value1
…)
. This format allows for more than one value per
parameter-name.
A parameter-list is a list of parameters, each with a different parameter-name.
Returns an empty parameter-list with slots for parameter-names.
parameter-name must name a valid slot of parameter-list.
parameter-list-ref
returns the value of parameter
parameter-name of parameter-list.
Removes the parameter parameter-name from parameter-list.
remove-parameter
does not alter the argument
parameter-list.
If there are more than one parameter-name parameters, an error is signaled.
Returns parameter-list with parameter1 … merged in.
expanders is a list of procedures whose order matches the order of
the parameter-names in the call to make-parameter-list
which created parameter-list. For each non-false element of
expanders that procedure is mapped over the corresponding
parameter value and the returned parameter lists are merged into
parameter-list.
This process is repeated until parameter-list stops growing. The
value returned from parameter-list-expand
is unspecified.
defaulters is a list of procedures whose order matches the order
of the parameter-names in the call to make-parameter-list
which created parameter-list. fill-empty-parameters
returns a new parameter-list with each empty parameter replaced with the
list returned by calling the corresponding defaulter with
parameter-list as its argument.
checks is a list of procedures whose order matches the order of
the parameter-names in the call to make-parameter-list
which created parameter-list.
check-parameters
returns parameter-list if each check
of the corresponding parameter-list returns non-false. If some
check returns #f
a warning is signaled.
In the following procedures arities is a list of symbols. The
elements of arities
can be:
single
Requires a single parameter.
optional
A single parameter or no parameter is acceptable.
boolean
A single boolean parameter or zero parameters is acceptable.
nary
Any number of parameters are acceptable.
nary1
One or more of parameters are acceptable.
Returns parameter-list converted to an argument list. Parameters
of arity type single
and boolean
are converted to
the single value associated with them. The other arity types are
converted to lists of the value(s).
positions is a list of positive integers whose order matches the
order of the parameter-names in the call to
make-parameter-list
which created parameter-list. The
integers specify in which argument position the corresponding parameter
should appear.
Next: Getopt Parameter lists, Previous: Command Line, Up: Programs and Arguments [Contents][Index]