cl-unification

API Reference

cl-ppcre-template

A system used to conditionally load the CL-PPCRE Template. This system is not required and it is handled only if CL-PPCRE is available. If it is, then the library provides the REGULAR-EXPRESSION-TEMPLATE.

No packages.

cl-unification

The CL-UNIFICATION system. The system contains the definitions for the 'unification' machinery.

IT.UNIMIB.DISCO.MA.CL.EXT.DACF.UNIFICATION

The CL.EXT.DACF.UNIFICATION Package.

This package contains all the definitions necessary for the general
Common Lisp unifier to work.
The package also has the "UNIFY" nickname.
  • Function VARIABLEP (x)
  • Function VARIABLE-ANY-P (x)
  • Function BINDING-VARIABLE (b)
  • Function (setf BINDING-VARIABLE) (v b)
  • Function BINDING-VALUE (b)
  • Function (setf BINDING-VALUE) (v b)
  • Condition UNIFICATION-VARIABLE-UNBOUND  (UNBOUND-VARIABLE)
    This is the condition that is signaled
  • Condition UNIFICATION-FAILURE  (SIMPLE-ERROR)
  • Struct ENVIRONMENT
    The ENVIRONMENT structure. The data structure containing the associations (bindings) between variables and values.
    FRAMES
  • Function ENVIRONMENT-P (object)
  • Type SUBSTITUTION
    The SUBSTITUTION type. The type representing the associations between variables and values. Notes: It is a synonim for the structure type ENVIRONMENT.
  • Function MAKE-EMPTY-ENVIRONMENT
  • Function COPY-ENVIRONMENT (env)
  • Function MAKE-SHARED-ENVIRONMENT (env &optional (pushp nil))
  • Function PUSH-FRAME (env)
  • Function POP-FRAME (env)
  • Function EMPTY-ENVIRONMENT-P (env)
  • Function FIND-VARIABLE-VALUE (variable &optional (env *null-environment*) errorp)
    Finds the value associated to VARIABLE in ENV. VARIABLE is a unification variable; if ERRORP is non-null an error is signaled if VARIABLE is not found in the environment ENV. The function returns two values: the value associated to VARIABLE or NIL, and an indication about whether an association was actually found in ENV. Arguments and Values: VARIABLE : a unification variable ENV : and ENVIRONMENT ERRORP : a generalized Boolean result : a T foundp : a BOOLEAN Exceptional Situations: If an error is signaled, then it is an instance of UNIFICATION-VARIABLE-UNBOUND. Notes: FIND-VARIABLE-VALUE is almost symmetric to IS-VARIABLE-BOUND.
  • Function EXTEND-ENVIRONMENT (var pat &optional (env (make-empty-environment)))
  • Function FILL-ENVIRONMENT (vars pats &optional (env (make-empty-environment)))
  • Function FILL-ENVIRONMENT* (vars-pats &optional (env (make-empty-environment)))
  • Function V? (s env &optional (plain-symbol-p nil))
    Finds the value associated to the variable S in ENV. This function is essentialy a convenience wrapper around FIND-VARIABLE-VALUE. If PLAIN-SYMBOL-P is non-NIL, then the symbol S is ensured to be a 'unification variable' (with a #? first character). Exceptional Situations: A UNIFICATION-VARIABLE-UNBOUND may be signaled is ERRORP is non-nil and no association si found for S in ENV.
  • Class TEMPLATE
    The TEMPLATE Class. The root of the hierarchy of template objects.
    SPEC   Accessor: TEMPLATE-SPEC
  • Generic-Function TEMPLATE-P (x)
    Returns T if the argument X is a TEMPLATE. Arguments and Values: X : any object result : a BOOLEAN
  • Method TEMPLATE-P ((x t))
  • Method TEMPLATE-P ((x t))
  • Method TEMPLATE-P ((x t))
  • Class TYPE-TEMPLATE  (TEMPLATE)
    No slots.
  • Generic-Function TYPE-TEMPLATE-P (x)
  • Method TYPE-TEMPLATE-P ((x t))
  • Method TYPE-TEMPLATE-P ((x t))
  • Method TYPE-TEMPLATE-P ((x t))
  • Class NIL-TEMPLATE  (TYPE-TEMPLATE)
    No slots.
  • Generic-Function NIL-TEMPLATE-P (x)
  • Method NIL-TEMPLATE-P ((x t))
  • Method NIL-TEMPLATE-P ((x t))
  • Method NIL-TEMPLATE-P ((x t))
  • Class EXPRESSION-TEMPLATE  (TEMPLATE)
    The EXPRESSION-TEMPLATE Class. This class is the root of the 'expression template' sub-hierarchy.
    No slots.
  • Generic-Function EXPRESSION-TEMPLATE-P (x)
  • Method EXPRESSION-TEMPLATE-P ((x t))
  • Method EXPRESSION-TEMPLATE-P ((x t))
  • Method EXPRESSION-TEMPLATE-P ((x t))
  • Class ARRAY-TEMPLATE  (TYPE-TEMPLATE)
    The ARRAY-TEMPLATE Class. The instances of this class are objects that can be used to unify against arrays. The syntax of this particular template is the following: <pre> #T(array &lt;shape-template&gt;) </pre> <pre> #T(&lt;CL array type specifier&gt; &lt;shape-template&gt;) </pre> <pre> #T(array ([* | &lt;CL type specifier&gt;] [&lt;dimension spec&gt;]) &lt;shape-template&gt;) </pre> Where &lt;shape-template&gt; can be: <pre> &lt;shape-template&gt; ::= &lt;sequence-template&gt; | &lt;destructuring template lambda list&gt; | (&lt;shape-template&gt;) </pre> The ARRAY-TEMPLATE syntax denotes an ARRAY object. An ARRAY-TEMPLATE must be unified against an ARRAY object. The elements of the array must be unified against the &lt;shape-template&gt;. Each row of the array is unified recursively against each element of the &lt;shape-template&gt;. Examples: cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(array (0 1 ?x 3 4 5)))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 cl-prompt> (setq e (unify #(0 1 42 3 4 5) #T(array (0 1 "FOO" 3 4 5)))) ==> Error: UNIFICATION-FAILURE cl-prompt> (setq e (unify #2A((0 1 42) (3 4 5)) #T(array ((0 1 ?x) (3 4 5))))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 cl-prompt> (setq e (unify #2A(("foo" "bar" 42) (3 4 5)) #T(array ((_ _ ?x) (3 4 5))))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 cl-prompt> (setq e (unify #2A(("foo" "bar" 42) (3 4 5)) #T(array (#T(vector _ &rest ?x) (3 4 5))))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) #("bar" 42) Exceptional Situations: Unifying an ARRAY-TEMPLATE against a non-ARRAY object results in an UNIFICATION-FAILURE error being signaled. Notes: <h3>Syntax Note</h3> The ARRAY-TEMPLATE syntax tries to be easy to use, at the cost of being overloaded. There is no actual need to have the separate forms <code>(<b>array</b> (fixnum) ...)</code> and <code>((<b>array</b> fixnum) ...)</code>. In a future release they may be conflated. For the time being they are kept separate as it is unclear which would be better to provide. <h3>Elements Unification</h3> It would be nice to have the possibility to unify against <em>slices</em> of the array. Alas, this seems non trivial to get right, and it is left as a future extension of the semantics of <i>&lt;shape-template&gt;</i>. <h3>ARRAY Structural Properties</h3> For the time being, there is no way to "unify" against structural properties of vectors like fill pointers and displacements.
    No slots.
  • Generic-Function ARRAY-TEMPLATE-P (x)
  • Method ARRAY-TEMPLATE-P ((x t))
  • Method ARRAY-TEMPLATE-P ((x t))
  • Method ARRAY-TEMPLATE-P ((x t))
  • Class SYMBOL-TEMPLATE  (TYPE-TEMPLATE)
    No slots.
  • Generic-Function SYMBOL-TEMPLATE-P (x)
  • Method SYMBOL-TEMPLATE-P ((x t))
  • Method SYMBOL-TEMPLATE-P ((x t))
  • Method SYMBOL-TEMPLATE-P ((x t))
  • Class NUMBER-TEMPLATE  (TYPE-TEMPLATE)
    No slots.
  • Generic-Function NUMBER-TEMPLATE-P (x)
  • Method NUMBER-TEMPLATE-P ((x t))
  • Method NUMBER-TEMPLATE-P ((x t))
  • Method NUMBER-TEMPLATE-P ((x t))
  • Class STRUCTURE-OBJECT-TEMPLATE  (TYPE-TEMPLATE)
    No slots.
  • Generic-Function STRUCTURE-OBJECT-TEMPLATE-P (x)
  • Method STRUCTURE-OBJECT-TEMPLATE-P ((x t))
  • Method STRUCTURE-OBJECT-TEMPLATE-P ((x t))
  • Method STRUCTURE-OBJECT-TEMPLATE-P ((x t))
  • Class STANDARD-OBJECT-TEMPLATE  (TYPE-TEMPLATE)
    No slots.
  • Generic-Function STANDARD-OBJECT-TEMPLATE-P (x)
  • Method STANDARD-OBJECT-TEMPLATE-P ((x t))
  • Method STANDARD-OBJECT-TEMPLATE-P ((x t))
  • Method STANDARD-OBJECT-TEMPLATE-P ((x t))
  • Class ELEMENT-TEMPLATE  (EXPRESSION-TEMPLATE)
    The ELEMENT-TEMPLATE Class. The instances of this class are those object that are used to unify against a particular element of an ARRAY or a SEQUENCE.
    No slots.
  • Generic-Function ELEMENT-TEMPLATE-P (x)
  • Method ELEMENT-TEMPLATE-P ((x t))
  • Method ELEMENT-TEMPLATE-P ((x t))
  • Method ELEMENT-TEMPLATE-P ((x t))
  • Class ELT-TEMPLATE  (ELEMENT-TEMPLATE)
    No slots.
  • Generic-Function ELT-TEMPLATE-P (x)
  • Method ELT-TEMPLATE-P ((x t))
  • Method ELT-TEMPLATE-P ((x t))
  • Method ELT-TEMPLATE-P ((x t))
  • Class AREF-TEMPLATE  (ELEMENT-TEMPLATE)
    The AREF-TEMPLATE Class. The instances of this class are those object that are used to unify against a particular element of an ARRAY. The syntax of these templates is the following: <pre> #T(<b>aref</b> (<i>index1</i> ... <i>indexN</i>) <i>item</i>) </pre> <pre> #T(<b>aref</b> <i>index</i> <i>item</i>) </pre> The AREF-TEMPLATE syntax denotes the <i>item</i> at <i>index1</i> ... <i>indexN</i> of an ARRAY. An AREF-TEMPLATE must be unified against a ARRAY object. <i>item</i> is <em>unified</em> against the element extracted from the sequence object at <i>index1</i> ... <i>indexN</i> by the standard function AREF. The second form is a shorthand. <pre> #T(<b>aref</b> <i>index</i> <i>item</i>) <==> #T(<b>aref</b> (<i>index</i>) <i>item</i>) </pre> Examples: cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(aref 2 ?x))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 cl-prompt> (setq e (unify #(0 1 42 3 4 5) #T(aref 42 ?x))) ==> Error: index 42 out of bounds. cl-prompt> (setq e (unify 42 #T(aref 42 ?x))) ==> Error: UNIFICATION-FAILURE cl-prompt> (setq e (unify "This is a string!" #T(aref 4 ?x))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) #\Space cl-prompt> (setq e (unify #2A((1 0) (foo bar)) #T(aref (1 1) ?x))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) BAR cl-prompt> (setq e (unify #2A((1 0) (foo bar)) #T(aref (1 1) baz))) ==> Error: UNIFICATION-FAILURE cl-prompt> (setq e (unify #2A((1 0) (foo ?x)) #T(aref (1 1) baz))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) BAZ Exceptional Situations: Unifying an AREF-TEMPLATE against a non-ARRAY object results in an UNIFICATION-FAILURE error being signaled.
    No slots.
  • Generic-Function AREF-TEMPLATE-P (x)
  • Method AREF-TEMPLATE-P ((x t))
  • Method AREF-TEMPLATE-P ((x t))
  • Method AREF-TEMPLATE-P ((x t))
  • Class NTH-TEMPLATE  (ELEMENT-TEMPLATE)
    No slots.
  • Generic-Function NTH-TEMPLATE-P (x)
  • Method NTH-TEMPLATE-P ((x t))
  • Method NTH-TEMPLATE-P ((x t))
  • Method NTH-TEMPLATE-P ((x t))
  • Class NTHCDR-TEMPLATE  (ELEMENT-TEMPLATE)
    No slots.
  • Generic-Function NTHCDR-TEMPLATE-P (x)
  • Method NTHCDR-TEMPLATE-P ((x t))
  • Method NTHCDR-TEMPLATE-P ((x t))
  • Method NTHCDR-TEMPLATE-P ((x t))
  • Generic-Function MAKE-TEMPLATE (kind spec)
    The 'template' factory. Creates a TEMPLATE instance based on the values of KIND and SPEC. Arguments and Values: KIND : a T SPEC : a T result : a TEMPLATE Exceptional Situations: May signal an error if a particular combination of KIND and SPEC is either not consistent or handled.
  • Method MAKE-TEMPLATE ((kind null) (spec symbol))
  • Method MAKE-TEMPLATE ((kind symbol) (spec symbol))
  • Method MAKE-TEMPLATE ((kind (eql 'symbol)) (spec cons))
  • Method MAKE-TEMPLATE ((kind symbol) (spec cons))
  • Method MAKE-TEMPLATE ((kind cons) (spec cons))
  • Method MAKE-TEMPLATE ((kind number) (spec number))
  • Method MAKE-TEMPLATE ((kind (eql 'sequence)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'list)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'plist)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'lambda)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'vector)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'string)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'array)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'subseq)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'elt)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'aref)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'nth)) (spec cons))
  • Method MAKE-TEMPLATE ((kind (eql 'nthcdr)) (spec cons))
  • Generic-Function COLLECT-TEMPLATE-VARS (template)
  • Method COLLECT-TEMPLATE-VARS ((template template))
  • Method COLLECT-TEMPLATE-VARS ((template symbol-template))
  • Method COLLECT-TEMPLATE-VARS ((template number-template))
  • Method COLLECT-TEMPLATE-VARS ((template symbol))
  • Method COLLECT-TEMPLATE-VARS ((template null))
  • Method COLLECT-TEMPLATE-VARS ((template cons))
  • Method COLLECT-TEMPLATE-VARS ((template string))
  • Method COLLECT-TEMPLATE-VARS ((template vector))
  • Method COLLECT-TEMPLATE-VARS ((template array))
  • Method COLLECT-TEMPLATE-VARS ((template t))
  • Generic-Function UNIFY (a b &optional env &key &allow-other-keys)
    Unifies two objects A and B given a substitution ENV. A is a Common Lisp object and B is either a Common Lisp object or a "template", A and B can be commuted. The unification rules are rather complex. Each method of the generic function implements a specific rule of unification. The generic function returns a `substitution' upon success or it signals a UNIFICATION-FAILURE condition upon failure.
  • Method UNIFY ((a symbol) (b list) &optional (env (make-empty-environment)) &key &allow-other-keys)
    Unifies a symbol A and a list B in an environment ENV. If A is not a variable then an error of type UNIFICATION-FAILURE is signaled. If A is a unification variable, then the environment ENV is extended with a binding for A to B, unless the occurrence check is called and fails, in which case an error is signaled.
  • Method UNIFY ((b list) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
    Unifies a symbol B and a list A in an environment ENV. If A is not a variable then an error of type UNIFICATION-FAILURE is signaled. If A is a unification variable, then the environment ENV is extended with a binding for A to B, unless the occurrence check is called and fails, in which case an error is signaled.
  • Method UNIFY ((a list) (b list) &optional (env (make-empty-environment)) &key &allow-other-keys)
    Unifies a list A and a list B in an environment ENV. The unification procedure proceedes recursively on each element of both lists. If two elements cannot be unified then an error of type UNIFICATION-FAILURE is signaled. Otherwise a possibly extended environment is returned.
  • Method UNIFY ((a number) (b number) &optional (env (make-empty-environment)) &key &allow-other-keys)
    Unifies two numbers A and B. Two numbers unify only if and only if they are equal as per the function #'=, in which case an unmodified envirironment ENV is returned. Otherwise an error of type UNIFICATION-FAILURE is signalled. Of course, asking for unification of two floating point numbers may not yield the expected result.
  • Variable *UNIFY-STRING-CASE-SENSITIVE-P*
    t
  • Method UNIFY ((a character) (b character) &optional (env (make-empty-environment)) &key (case-sensitive *unify-string-case-sensitive-p*) &allow-other-keys)
    Unifies two strings A and B. Two CHARACTERs A and B unify if and only if they satisfy either #'CHAR= or #'CHAR-EQUAL. The choice of which of test to perform (#'CHAR= or #'CHAR-EQUAL) is made according to the value of the variable *UNIFY-STRING-CASE-SENSITIVE-P*, which defaults to T. If A and B unify then an unmodified environment ENV is returned, otherwise an error of type UNIFICATION-FAILURE is signaled.
  • Method UNIFY ((a string) (b string) &optional (env (make-empty-environment)) &key (case-sensitive *unify-string-case-sensitive-p*) &allow-other-keys)
    Unifies two strings A and B. Two strings A and B unify if and only if they satisfy either #'STRING= or #'STRING-EQUAL. The choice of which of test to perform (#'STRING= or #'STRING-EQUAL) is made according to the value of the variable *UNIFY-STRING-CASE-SENSITIVE-P*, which defaults to T. If A and B unify then an unmodified environment ENV is returned, otherwise an error of type UNIFICATION-FAILURE is signaled.
  • Method UNIFY ((a symbol) (b string) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b string) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a symbol) (b symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a symbol) (b t) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b t) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a symbol) (b array) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b array) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((as vector) (bs vector) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((s1 sequence) (s2 sequence) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((as array) (bs array) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a t) (b t) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((x template) (y template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((a symbol) (b symbol-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b symbol-template) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a symbol) (b template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b template) (a symbol) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a number) (b number-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b number-template) (a number) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a number) (b number-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a number) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((b template) (a number) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a sequence) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((b template) (a sequence) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a list) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((a list) (b sequence-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b template) (a list) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a list) (b plist-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a vector) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((a vector) (b sequence-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b template) (a vector) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a array) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((b template) (a array) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a array) (b array-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a standard-object) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((a standard-object) (b standard-object-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b template) (a standard-object) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a structure-object) (b template) &optional (env) &key &allow-other-keys)
  • Method UNIFY ((a structure-object) (b structure-object-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b template) (a structure-object) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a sequence) (b subseq-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a list) (b subseq-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a vector) (b subseq-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b subseq-template) (a sequence) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a array) (b aref-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a vector) (b aref-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b aref-template) (a array) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a sequence) (b elt-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a vector) (b elt-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a list) (b elt-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b elt-template) (a sequence) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((a list) (b nth-template) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Method UNIFY ((b nth-template) (a list) &optional (env (make-empty-environment)) &key &allow-other-keys)
  • Function UNIFY* (a b &optional (env (make-empty-environment)))
  • Function UNIFY-EQUATIONS (eqns &optional (env (make-empty-environment)))
  • Function UNIFY-EQUATIONS* (lhss rhss &optional (env (make-empty-environment)))
  • Macro MATCH ((template object &key (match-named nil) (substitution '(make-empty-environment)) (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.
  • Macro MATCHF ((template object &key (match-named nil) (substitution '(make-empty-environment)) (errorp t) (error-value nil)) &body forms)
    Sets up a lexical environment to evaluate FORMS after an unification. MATCHF 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. 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 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.
  • Macro MATCHING ((&key errorp (default-substitution (make-empty-environment)) (matching-named nil)) &rest match-clauses)
    MATCHING sets up a COND-like environment for multiple template matching clauses. The syntax of MATCHING comprises a number of clauses, collected in MATCH-CLAUSES, of the form <pre> clause ::= regular-clause | default-clause regular-clause ::= '(' '(' template form ')' '&body' forms ')' default-clause ::= '(' 't' '&body' forms ')' | '(' 'otherwise' '&body' forms ')' </pre> 'form' and 'forms' are regular Common Lisp forms. 'template' is a unification template. The full syntax of MATCHING is <pre> matching (&key errorp default-substitution) clauses </pre> 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-EXAUSTIVE 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. MATCHING-NAMED is used as BLOCK name around the MATCHING machinery. DEFAULT-SUBSTITUTION is the substitution to be used for the matching; it defaults to the empty substitution.
  • Macro MATCH-CASE ((object &key errorp default-substitution match-case-named) &body clauses)
    MATCH-CASE sets up a CASE-like environment for multiple template matching clauses. The syntax of MATCH-CASE comprises a number of clauses of the form <pre> clause ::= regular-clause | default-clause regular-clause ::= '(' template '&body' forms ')' default-clause ::= '(' t '&body' forms ')' | '(' 'otherwise' '&body' forms ')' </pre> 'form' and 'forms' are regular Common Lisp forms. 'template' is a unification template. The full syntax of MATCH-CASE is <pre> match-case (object &key errorp default-substitution) clauses </pre> 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 MATCH-CASE 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-EXAUSTIVE is signalled, regardless of any default clause. Otherwise, the default clause behaves as a standard CASE default clause. The default value of ERRORP is NIL. MATCHING-NAMED is used as BLOCK name around the MATCHING machinery. DEFAULT-SUBSTITUTION is the substitution to be used for the matching; it defaults to the empty substitution.
  • Macro MATCHF-CASE ((object &key errorp default-substitution match-case-named) &body clauses)
    MATCHF-CASE sets up a CASE-like environment for multiple template matching clauses. The syntax of MATCHF-CASE comprises a number of clauses of the form <pre> clause ::= regular-clause | default-clause regular-clause ::= '(' template '&body' forms ')' default-clause ::= '(' t '&body' forms ')' | '(' 'otherwise' '&body' forms ')' </pre> 'form' and 'forms' are regular Common Lisp forms. 'template' is a unification template. The full syntax of MATCHF-CASE is matchf-case (object &key errorp default-substitution) 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 MATCH-CASE 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-EXAUSTIVE is signalled, regardless of any default clause. Otherwise, the default clause behaves as a standard CASE default clause. The default value of ERRORP is NIL. MATCHING-NAMED is used as BLOCK name around the MATCHING machinery. DEFAULT-SUBSTITUTION is the substitution to be used for the matching; it defaults to the empty substitution. Notes: MATCHF-CASE behaves like MATCH-CASE, but the patterns are not evaluated; i.e., it relies on MATCHF instead of MATCH to construct the macro expansion.
  • Generic-Function APPLY-SUBSTITUTION (substitution item &optional exclude-vars)
    Applies a SUBSTITUTION to an ITEM.
  • Method APPLY-SUBSTITUTION ((substitution environment) (s symbol) &optional (exclude-vars nil))
  • Method APPLY-SUBSTITUTION ((substitution environment) (l cons) &optional (exclude-vars nil))
  • Method APPLY-SUBSTITUTION ((substitution environment) (l null) &optional exclude-vars)

cl-unification-lib

No packages.