Fri Feb 5 03:21:40 UTC 2010 pix@kepibu.org * Unified docstrings. diff -rN -u old-cl-unification-1/match-block.lisp new-cl-unification-1/match-block.lisp --- old-cl-unification-1/match-block.lisp 2014-09-11 07:35:02.000000000 +0000 +++ new-cl-unification-1/match-block.lisp 2014-09-11 07:35:02.000000000 +0000 @@ -117,6 +117,11 @@ ,@(when default-clauses `((t ,@(cdar default-clauses)))) ,@(when default `((t ,default)))))))))) +(defmacro %set-documentation ((&rest symbols) docstring) + `(eval-when (:load-toplevel :execute) + (mapcar (lambda (fn) (setf (documentation fn 'function) ,docstring)) + ',symbols))) + (defmacro match ((template object &key (named nil) @@ -125,25 +130,6 @@ (errorp t) (error-value nil)) &body forms) - "Sets up a lexical environment to evaluate FORMS after an unification. - -MATCH unifies a TEMPLATE and an OBJECT and then sets up a lexical -environment where the variables present in the template are bound -lexically. Note that both variable names '?FOO' and 'FOO' are bound -for convenience. - -The MATCH form returns the values returned by the evaluation of the -last of the FORMS. - -If ERRORP is non-NIL (the default) then the form raises a -UNIFICATION-FAILURE, otherwise the result of evaluating ERROR-VALUE, -whose default is NIL is returned. (Note that UNIFICATION-FAILUREs -raising from the evaluation of FORMS will also be caught and handled -according to ERRORP settings.) - -If MATCH-NAMED is not NIL, then a surrounding BLOCK named MATCH-NAMED -is set up around the matching code. -" (when match-named-p (warn ":match-named is deprecated. Use :named instead.")) (%match-expander 'match @@ -162,9 +148,21 @@ (errorp t) (error-value nil)) &body forms) - "Sets up a lexical environment to evaluate FORMS after an unification. + (when match-named-p + (warn ":match-named is deprecated. Use :named instead.")) + (%match-expander 'matchf + 'nil + `((,template ,object ,@forms)) + :default error-value + :named (or named match-named) + :environment substitution + :errorp errorp)) + +(%set-documentation + (match matchf) + "Sets up a lexical environment to evaluate FORMS after an unification. -MATCHF unifies a TEMPLATE and an OBJECT and then sets up a lexical +MATCH and MATCHF unify a TEMPLATE and an OBJECT and then set up a lexical environment where the variables present in the template are bound lexically. Note that both variable names '?FOO' and 'FOO' are bound for convenience. @@ -172,27 +170,16 @@ MATCHF does not 'evaluate' TEMPLATE (note that using the #T syntax will generate a template at read-time). -The MATCHF form returns the values returned by the evaluation of the +MATCH and MATCHF forms return the values returned by the evaluation of the last of the FORMS. If ERRORP is non-NIL (the default) then the form raises a UNIFICATION-FAILURE, otherwise the result of evaluating ERROR-VALUE, whose default is NIL is returned. (Note that UNIFICATION-FAILUREs -raising from the evaluation of FORMS will also be caught and handled +raising from the evaluation of FORMS will /not/ be caught and handled according to ERRORP settings.) -If MATCH-NAMED is not NIL, then a surrounding BLOCK named MATCH-NAMED -is set up around the matching code. -" - (when match-named-p - (warn ":match-named is deprecated. Use :named instead.")) - (%match-expander 'matchf - 'nil - `((,template ,object ,@forms)) - :default error-value - :named (or named match-named) - :environment substitution - :errorp errorp)) +A surrounding BLOCK named NAMED is set up around the matching code.") @@ -203,11 +190,9 @@ (defmacro match-cond (&body clauses) - "A combination of COND and MATCH." (%match-expander 'match 'cond clauses)) (defmacro matchf-cond (&body clauses) - "A combination of COND and MATCHF." (%match-expander 'matchf 'cond clauses)) (defmacro matching ((&key errorp @@ -215,33 +200,6 @@ (named nil) (matching-named nil matching-named-p)) &body match-clauses) - "MATCHING sets up a COND-like environment for multiple template matching clauses. - -The syntax of MATCHING comprises a number of clauses of the form - - ::= | - ::= ((