CL Unification: Macro MATCHING
 

Macro MATCHING

Package:

COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION

Syntax:

  matching (&key errorp) <clause>*
  => results*
  

  <clause>         ::= <regular clause> | <default clause>
  <regular clause> ::= ((template object) &body forms)
  <default clause> ::= (t &body forms)
                   |   (otherwise &body forms)
  

Arguments and Values:

template---a unification template

object---an object

substitution---a substitution

errorp---a generalized boolean

error-value---an object

forms---an implicit progn

results---the values returned by forms

Description:

MATCHING sets up a COND-like environment for multiple template matching clauses. Each clause evaluates its forms in an environment where the variables present in the template are bound lexically. Note that both variable names '?FOO' and 'FOO' are bound for convenience.

The values returned by the MATCHING form are those of the last form in the first clause that satisfies the match test.

If errorp is non-NIL then if none of the regular clauses matches, then an error of type UNIFICATION-NON-EXHAUSTIVE is signalled, regardless of any default clause. Otherwise, the default clause behaves as a standard COND default clause. The default value of errorp is NIL.

Affected By:

None.

Exceptional Situations:

See above.

See Also:

UNIFY, UNIFICATION-FAILURE, UNIFICATION-NON-EXHAUSTIVE

Notes:

Note that UNIFICATION-FAILUREs raising from the evaluation of forms in each clause will not be caught and handled by the enclosing MATCHING block..

 

News

News in chronological order, most recent on top.

  • 2004-06-11
    Completed description.