Copyright (C) 2000-2012 |
GNU Info (slib.info)Parameter listsParameter lists --------------- `(require 'parameters)' 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. - Function: make-parameter-list parameter-names Returns an empty parameter-list with slots for PARAMETER-NAMES. - Function: parameter-list-ref parameter-list parameter-name PARAMETER-NAME must name a valid slot of PARAMETER-LIST. `parameter-list-ref' returns the value of parameter PARAMETER-NAME of PARAMETER-LIST. - Function: remove-parameter parameter-name 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. - Procedure: adjoin-parameters! parameter-list parameter1 ... Returns PARAMETER-LIST with PARAMETER1 ... merged in. - Procedure: parameter-list-expand expanders parameter-list 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. - Function: fill-empty-parameters defaulters parameter-list 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. - Function: check-parameters checks parameter-list 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. - Function: parameter-list->arglist positions arities parameter-list 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. automatically generated by info2www version 1.2.2.9 |