[alexandria-devel] Review cycle 1: binding constructs

Nikodemus Siivola nikodemus at random-state.net
Tue May 27 11:44:01 UTC 2008


macro IF-LET (bindings then-form &optional else-form)

Creates new variable bindings, and conditionally executes either
THEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.

BINDINGS must be either single binding of the form:

 (variable initial-form)

or a list of bindings of the form:

 ((variable-1 initial-form-1)
  (variable-2 initial-form-2)
  ...
  (variable-n initial-form-n))

All initial-forms are executed sequentially in the specified order.
Then all the variables are bound to the corresponding values.

If all variables were bound to true values, the THEN-FORM is executed
with the bindings in effect, otherwise the ELSE-FORM is executed with
the bindings in effect.

-------

macro IF-LET* (bindings then-form &optional else-form)

Creates new variable bindings, and conditionally executes either
THEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.

BINDINGS must be either single binding of the form:

 (variable initial-form)

or a list of bindings of the form:

 ((variable-1 initial-form-1)
  (variable-2 initial-form-2)
  ...
  (variable-n initial-form-n))

Each initial-form is executed in turn, and the variable bound to the
corresponding value. Initial-form expressions can refer to variables
previously bound by the IF-LET*.

If all variables are true after the bindings are complete, the
THEN-FORM is executed with the bindings in effect, otherwise the
ELSE-FORM is executed with the bindings in effect.

------

macro WHEN-LET (bindings &body forms)

Creates new variable bindings, and conditionally executes FORMS.

BINDINGS must be either single binding of the form:

 (variable initial-form)

or a list of bindings of the form:

 ((variable-1 initial-form-1)
  (variable-2 initial-form-2)
  ...
  (variable-n initial-form-n))

All initial-forms are executed sequentially in the specified order.
Then all the variables are bound to the corresponding values.

If all variables were bound to true values, then FORMS are executed as
an implicit PROGN.

------

 WHEN-LET* (bindings &body forms)

Creates new variable bindings, and conditionally executes FORMS.

BINDINGS must be either single binding of the form:

 (variable initial-form)

or a list of bindings of the form:

 ((variable-1 initial-form-1)
  (variable-2 initial-form-2)
  ...
  (variable-n initial-form-n))

Each initial-form is executed in turn, and the variable bound to the
corresponding value. Initial-form expressions can refer to variables
previously bound by the WHEN-LET*.

If all variables are true after the bindings are complete, then FORMS
are executed as an implicit PROGN.

------

The floor is open,

 -- Nikodemus



More information about the alexandria-devel mailing list