doc.txt

Parameter-Utils: Parameterization utilities

_Parameter-Utils: Parameterization utilities_

Written by: Carl Eastlund (cce at ccs dot neu dot edu)
Keywords: _parameter_, _parameterize_, _parameterization_

This software is distributed under a BSD-style license (see license.txt).

================================================================================

Macro provided by _parameter-utils.ss_:

> (param-lambda (ARG-CLAUSE ...) expr ...)
  where ARG-CLAUSE may be:
    id
    [id default]
    [id => parameter]
  expr : Expression
  id : Identifier
  default : Expression
  parameter : Expression

This macro produces an anonymous function, much like lambda or opt-lambda.  It
may be used as a drop-in replacement for opt-lambda (and therefore also for
lambda).  It has one additional feature, the [id => parameter] argument clause.
In this case, the named argument corresponds to the given parameter.  When the
argument is provided, the parameter is given the argument's value during
execution of the function's body.  When the argument is not provided, it is
given the parameter's value at the time of the function's invocation.

Example 1:

((param-lambda (x [y 0] [z => param]) BODY ...) 1 2 3)
is the same as
(let ([x 1] [y 2] [z 3]) (parameterize ([param z]) BODY ...))

Example 2:

((param-lambda (x [y 0] [z => param]) BODY ...) 1)
is the same as
(let ([x 1] [y 0] [z (param)]) BODY ...)