This is the cl-unification Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:29:35 2024 GMT+0.
cl-unification/cl-unification.asd
cl-unification/cl-unification-pkg.lisp
cl-unification/variables.lisp
cl-unification/substitutions.lisp
cl-unification/lambda-list-parsing.lisp
cl-unification/templates-hierarchy.lisp
cl-unification/unifier.lisp
cl-unification/match-block.lisp
cl-unification/apply-substitution.lisp
The main system appears first, followed by any subsystem dependency.
cl-unification
The CL-UNIFICATION system.
The system contains the definitions for the ’unification’ machinery.
Marco Antoniotti
BSD
cl-unification-pkg.lisp
(file).
variables.lisp
(file).
substitutions.lisp
(file).
lambda-list-parsing.lisp
(file).
templates-hierarchy.lisp
(file).
unifier.lisp
(file).
match-block.lisp
(file).
apply-substitution.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-unification/cl-unification.asd
cl-unification/cl-unification-pkg.lisp
cl-unification/variables.lisp
cl-unification/substitutions.lisp
cl-unification/lambda-list-parsing.lisp
cl-unification/templates-hierarchy.lisp
cl-unification/unifier.lisp
cl-unification/match-block.lisp
cl-unification/apply-substitution.lisp
cl-unification/cl-unification.asd
cl-unification
(system).
source-file-type
(method).
asdf-system-definition-file
(class).
cl-unification/cl-unification-pkg.lisp
cl-unification
(system).
cl-unification/variables.lisp
cl-unification-pkg.lisp
(file).
cl-unification
(system).
variable-any-p
(function).
variablep
(function).
make-var-name
(function).
cl-unification/substitutions.lisp
variables.lisp
(file).
cl-unification
(system).
binding-value
(function).
(setf binding-value)
(function).
binding-variable
(function).
(setf binding-variable)
(function).
copy-environment
(function).
empty-environment-p
(function).
environment
(structure).
environment-p
(function).
extend-environment
(function).
fill-environment
(function).
fill-environment*
(function).
find-variable-value
(function).
make-empty-environment
(function).
make-shared-environment
(function).
pop-frame
(function).
print-object
(method).
push-frame
(function).
substitution
(type).
unification-failure
(condition).
unification-variable-unbound
(condition).
v?
(function).
*null-environment*
(special variable).
binding
(type).
bindings
(type).
bindings-keys
(function).
bindings-values
(function).
copy-frame
(function).
dump-environment
(function).
dump-frame
(function).
empty-frame-p
(function).
environment-frames
(reader).
(setf environment-frames)
(writer).
environment-values
(function).
environment-variables
(function).
extend-bindings
(function).
find-variable-binding
(function).
find-variable-binding-in-frame
(function).
find-variable-value-in-frame
(function).
first-frame
(function).
frame
(structure).
frame-bindings
(reader).
(setf frame-bindings)
(writer).
frame-p
(function).
frame-values
(function).
frame-variables
(function).
is-variable-bound
(function).
make-binding
(function).
make-environment
(function).
make-frame
(function).
print-environment
(function).
substitution-p
(function).
cl-unification/lambda-list-parsing.lisp
substitutions.lisp
(file).
cl-unification
(system).
aux-lambda-var-info
(structure).
aux-lambda-var-info-default-value
(function).
aux-lambda-var-info-name
(function).
aux-lambda-var-info-name-for-supplied-indicator
(function).
aux-lambda-var-info-p
(function).
aux-lambda-var-info-type
(function).
copy-aux-lambda-var-info
(function).
copy-key-lambda-var-info
(function).
copy-lambda-var-info
(function).
copy-optional-lambda-var-info
(function).
copy-rest-lambda-var-info
(function).
key-lambda-var-info
(structure).
key-lambda-var-info-default-value
(function).
key-lambda-var-info-keyword-name
(reader).
key-lambda-var-info-name
(function).
key-lambda-var-info-name-for-supplied-indicator
(function).
key-lambda-var-info-p
(function).
key-lambda-var-info-type
(function).
lambda-list-parsing-error
(condition).
lambda-list-parsing-error-item
(reader method).
lambda-var-info
(structure).
lambda-var-info-name
(reader).
lambda-var-info-p
(function).
lambda-var-info-type
(reader).
make-aux-lambda-var-info
(function).
make-key-lambda-var-info
(function).
make-lambda-var-info
(function).
make-optional-lambda-var-info
(function).
make-rest-lambda-var-info
(function).
normalize-lambda-list
(function).
optional-lambda-var-info
(structure).
optional-lambda-var-info-default-value
(reader).
optional-lambda-var-info-name
(function).
optional-lambda-var-info-name-for-supplied-indicator
(reader).
optional-lambda-var-info-p
(function).
optional-lambda-var-info-type
(function).
parse-auxiliary-var-type-info
(function).
parse-extended-ordinary-lambda-list
(function).
parse-key-var-type-info
(function).
parse-optional-var-type-info
(function).
parse-rest-var-type-info
(function).
parse-var-type-info
(function).
rest-lambda-var-info
(structure).
rest-lambda-var-info-element-type
(reader).
rest-lambda-var-info-name
(function).
rest-lambda-var-info-p
(function).
rest-lambda-var-info-type
(function).
symbol-or-cons-p
(function).
type-is-t-p
(function).
type-specifier-p
(function).
cl-unification/templates-hierarchy.lisp
lambda-list-parsing.lisp
(file).
cl-unification
(system).
aref-template
(class).
aref-template-p
(generic function).
array-template
(class).
array-template-p
(generic function).
collect-template-vars
(generic function).
element-template
(class).
element-template-p
(generic function).
elt-template
(class).
elt-template-p
(generic function).
expression-template
(class).
expression-template-p
(generic function).
initialize-instance
(method).
initialize-instance
(method).
make-load-form
(method).
make-template
(generic function).
nil-template
(class).
nil-template-p
(generic function).
nth-template
(class).
nth-template-p
(generic function).
nthcdr-template
(class).
nthcdr-template-p
(generic function).
number-template
(class).
number-template-p
(generic function).
print-object
(method).
standard-object-template
(class).
standard-object-template-p
(generic function).
structure-object-template
(class).
structure-object-template-p
(generic function).
symbol-template
(class).
symbol-template-p
(generic function).
template
(class).
template-p
(generic function).
template-spec
(reader method).
(setf template-spec)
(writer method).
type-template
(class).
type-template-p
(generic function).
*known-number-template-constants*
(special variable).
aref-template-element
(function).
aref-template-indexes
(function).
array-template-dimensions
(function).
array-template-element-type
(function).
array-template-shape-template
(function).
lambda-template
(class).
lambda-template-p
(generic function).
list-template
(class).
list-template-p
(generic function).
number-template-number
(function).
number-template-numeric-class
(function).
number-template-numeric-type
(function).
plist-template
(class).
plist-template-p
(generic function).
sequence-template
(class).
sequence-template-lambda-list
(function).
sequence-template-p
(generic function).
sharp-t-reader
(function).
standard-object-template-class
(function).
standard-object-template-slots
(function).
string-template
(class).
string-template-p
(generic function).
structure-object-template-class
(function).
structure-object-template-slots
(function).
subseq-template
(class).
subseq-template-p
(generic function).
symbol-template-symbol
(function).
type-template-type-spec
(generic function).
unification-template-error
(condition).
vector-template
(class).
vector-template-element-type
(function).
vector-template-p
(generic function).
vector-template-size
(function).
cl-unification/unifier.lisp
templates-hierarchy.lisp
(file).
cl-unification
(system).
*unify-string-case-sensitive-p*
(special variable).
unify
(generic function).
unify*
(function).
unify-equations
(function).
unify-equations*
(function).
*occurrence-check-p*
(special variable).
occurs-in-p
(generic function).
unify-array-row
(function).
unify-array-rows
(function).
untyped-unify
(generic function).
valid-template-p
(function).
var-unify
(function).
cl-unification/match-block.lisp
unifier.lisp
(file).
cl-unification
(system).
match
(macro).
match-case
(macro).
matchf
(macro).
matchf-case
(macro).
matching
(macro).
clean-unify-var-name
(function).
unification-non-exhaustive
(condition).
cl-unification/apply-substitution.lisp
match-block.lisp
(file).
cl-unification
(system).
apply-substitution
(generic function).
compose-substitutions
(function).
ground-term
(function).
Packages are listed by definition order.
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.
cl.ext.dacf.unification
unify
unify
cl-unification
common-lisp
.
*unify-string-case-sensitive-p*
(special variable).
apply-substitution
(generic function).
aref-template
(class).
aref-template-p
(generic function).
array-template
(class).
array-template-p
(generic function).
binding-value
(function).
(setf binding-value)
(function).
binding-variable
(function).
(setf binding-variable)
(function).
collect-template-vars
(generic function).
copy-environment
(function).
element-template
(class).
element-template-p
(generic function).
elt-template
(class).
elt-template-p
(generic function).
empty-environment-p
(function).
environment
(structure).
environment-p
(function).
expression-template
(class).
expression-template-p
(generic function).
extend-environment
(function).
fill-environment
(function).
fill-environment*
(function).
find-variable-value
(function).
make-empty-environment
(function).
make-shared-environment
(function).
make-template
(generic function).
match
(macro).
match-case
(macro).
matchf
(macro).
matchf-case
(macro).
matching
(macro).
new-var
(function).
nil-template
(class).
nil-template-p
(generic function).
nth-template
(class).
nth-template-p
(generic function).
nthcdr-template
(class).
nthcdr-template-p
(generic function).
number-template
(class).
number-template-p
(generic function).
pop-frame
(function).
push-frame
(function).
standard-object-template
(class).
standard-object-template-p
(generic function).
structure-object-template
(class).
structure-object-template-p
(generic function).
substitution
(type).
symbol-template
(class).
symbol-template-p
(generic function).
template
(class).
template-p
(generic function).
template-spec
(generic reader).
(setf template-spec)
(generic writer).
type-template
(class).
type-template-p
(generic function).
unification-failure
(condition).
unification-variable-unbound
(condition).
unify
(generic function).
unify*
(function).
unify-equations
(function).
unify-equations*
(function).
v?
(function).
variable-any-p
(function).
variablep
(function).
*known-number-template-constants*
(special variable).
*null-environment*
(special variable).
*occurrence-check-p*
(special variable).
aref-template-element
(function).
aref-template-indexes
(function).
array-template-dimensions
(function).
array-template-element-type
(function).
array-template-shape-template
(function).
aux-lambda-var-info
(structure).
aux-lambda-var-info-default-value
(function).
aux-lambda-var-info-name
(function).
aux-lambda-var-info-name-for-supplied-indicator
(function).
aux-lambda-var-info-p
(function).
aux-lambda-var-info-type
(function).
binding
(type).
bindings
(type).
bindings-keys
(function).
bindings-values
(function).
clean-unify-var-name
(function).
compose-substitutions
(function).
copy-aux-lambda-var-info
(function).
copy-frame
(function).
copy-key-lambda-var-info
(function).
copy-lambda-var-info
(function).
copy-optional-lambda-var-info
(function).
copy-rest-lambda-var-info
(function).
dump-environment
(function).
dump-frame
(function).
empty-frame-p
(function).
environment-frames
(reader).
(setf environment-frames)
(writer).
environment-values
(function).
environment-variables
(function).
extend-bindings
(function).
find-variable-binding
(function).
find-variable-binding-in-frame
(function).
find-variable-value-in-frame
(function).
first-frame
(function).
frame
(structure).
frame-bindings
(reader).
(setf frame-bindings)
(writer).
frame-p
(function).
frame-values
(function).
frame-variables
(function).
ground-term
(function).
is-variable-bound
(function).
key-lambda-var-info
(structure).
key-lambda-var-info-default-value
(function).
key-lambda-var-info-keyword-name
(reader).
key-lambda-var-info-name
(function).
key-lambda-var-info-name-for-supplied-indicator
(function).
key-lambda-var-info-p
(function).
key-lambda-var-info-type
(function).
lambda-list-parsing-error
(condition).
lambda-list-parsing-error-item
(generic reader).
lambda-template
(class).
lambda-template-p
(generic function).
lambda-var-info
(structure).
lambda-var-info-name
(reader).
lambda-var-info-p
(function).
lambda-var-info-type
(reader).
list-template
(class).
list-template-p
(generic function).
make-aux-lambda-var-info
(function).
make-binding
(function).
make-environment
(function).
make-frame
(function).
make-key-lambda-var-info
(function).
make-lambda-var-info
(function).
make-optional-lambda-var-info
(function).
make-rest-lambda-var-info
(function).
make-var-name
(function).
normalize-lambda-list
(function).
number-template-number
(function).
number-template-numeric-class
(function).
number-template-numeric-type
(function).
occurs-in-p
(generic function).
optional-lambda-var-info
(structure).
optional-lambda-var-info-default-value
(reader).
optional-lambda-var-info-name
(function).
optional-lambda-var-info-name-for-supplied-indicator
(reader).
optional-lambda-var-info-p
(function).
optional-lambda-var-info-type
(function).
parse-auxiliary-var-type-info
(function).
parse-extended-ordinary-lambda-list
(function).
parse-key-var-type-info
(function).
parse-optional-var-type-info
(function).
parse-rest-var-type-info
(function).
parse-var-type-info
(function).
plist-template
(class).
plist-template-p
(generic function).
print-environment
(function).
rest-lambda-var-info
(structure).
rest-lambda-var-info-element-type
(reader).
rest-lambda-var-info-name
(function).
rest-lambda-var-info-p
(function).
rest-lambda-var-info-type
(function).
sequence-template
(class).
sequence-template-lambda-list
(function).
sequence-template-p
(generic function).
sharp-t-reader
(function).
standard-object-template-class
(function).
standard-object-template-slots
(function).
string-template
(class).
string-template-p
(generic function).
structure-object-template-class
(function).
structure-object-template-slots
(function).
subseq-template
(class).
subseq-template-p
(generic function).
substitution-p
(function).
symbol-or-cons-p
(function).
symbol-template-symbol
(function).
type-is-t-p
(function).
type-specifier-p
(function).
type-template-type-spec
(generic function).
unification-non-exhaustive
(condition).
unification-template-error
(condition).
unify-array-row
(function).
unify-array-rows
(function).
untyped-unify
(generic function).
valid-template-p
(function).
var-unify
(function).
vector-template
(class).
vector-template-element-type
(function).
vector-template-p
(generic function).
vector-template-size
(function).
cl-unification-system
asdf/interface
.
common-lisp
.
asdf-system-definition-file
(class).
Definitions are sorted by export status, category, package, and then by lexicographic order.
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.
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.
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.
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.
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.
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.
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.
Applies a SUBSTITUTION to an ITEM.
environment
) (l null
) &optional exclude-vars) ¶environment
) (l cons
) &optional exclude-vars) ¶environment
) (s symbol
) &optional exclude-vars) ¶environment
) (n number
) &optional exclude-vars) ¶aref-template
)) ¶array-template
)) ¶array
)) ¶vector
)) ¶string
)) ¶cons
)) ¶null
)) ¶symbol
)) ¶number-template
)) ¶symbol-template
)) ¶element-template
)) ¶elt-template
)) ¶expression-template
)) ¶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.
(eql nthcdr)
) (spec cons
)) ¶(eql nth)
) (spec cons
)) ¶(eql aref)
) (spec cons
)) ¶(eql elt)
) (spec cons
)) ¶(eql subseq)
) (spec cons
)) ¶(eql array)
) (spec cons
)) ¶(eql string)
) (spec cons
)) ¶(eql vector)
) (spec cons
)) ¶(eql lambda)
) (spec cons
)) ¶(eql it.unimib.disco.ma.cl.ext.dacf.unification::plist)
) (spec cons
)) ¶(eql list)
) (spec cons
)) ¶(eql sequence)
) (spec cons
)) ¶number
) (spec number
)) ¶cons
) (spec cons
)) ¶symbol
) (spec cons
)) ¶(eql symbol)
) (spec cons
)) ¶symbol
) (spec symbol
)) ¶null
) (spec symbol
)) ¶nil-template
)) ¶nth-template
)) ¶nthcdr-template
)) ¶number-template
)) ¶standard-object-template
)) ¶structure-object-template
)) ¶symbol-template
)) ¶Returns T if the argument X is a TEMPLATE.
Arguments and Values:
X : any object
result : a BOOLEAN
type-template
)) ¶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.
nth-template
) (a list
) &optional env &key &allow-other-keys) ¶list
) (b nth-template
) &optional env &key &allow-other-keys) ¶elt-template
) (a sequence
) &optional env &key &allow-other-keys) ¶list
) (b elt-template
) &optional env &key &allow-other-keys) ¶vector
) (b elt-template
) &optional env &key &allow-other-keys) ¶sequence
) (b elt-template
) &optional env &key &allow-other-keys) ¶aref-template
) (a array
) &optional env &key &allow-other-keys) ¶vector
) (b aref-template
) &optional env &key &allow-other-keys) ¶array
) (b aref-template
) &optional env &key &allow-other-keys) ¶subseq-template
) (a sequence
) &optional env &key &allow-other-keys) ¶vector
) (b subseq-template
) &optional env &key &allow-other-keys) ¶list
) (b subseq-template
) &optional env &key &allow-other-keys) ¶sequence
) (b subseq-template
) &optional env &key &allow-other-keys) ¶structure-object
) (b structure-object-template
) &optional env &key &allow-other-keys) ¶standard-object
) (b standard-object-template
) &optional env &key &allow-other-keys) ¶array
) (b array-template
) &optional env &key &allow-other-keys) ¶vector
) (b sequence-template
) &optional env &key &allow-other-keys) ¶list
) (b plist-template
) &optional env &key &allow-other-keys) ¶list
) (b sequence-template
) &optional env &key &allow-other-keys) ¶number
) (b number-template
) &optional env &key &allow-other-keys) ¶number-template
) (a number
) &optional env &key &allow-other-keys) ¶number
) (b number-template
) &optional env &key &allow-other-keys) ¶symbol-template
) (a symbol
) &optional env &key &allow-other-keys) ¶symbol
) (b symbol-template
) &optional env &key &allow-other-keys) ¶nil-template
) (nt2 nil-template
) &optional env &key &allow-other-keys) ¶nil-template
) (x null
) &optional env &key &allow-other-keys) ¶null
) (nt nil-template
) &optional env &key &allow-other-keys) ¶null
) (y null
) &optional env &key &allow-other-keys) ¶array
) (bs array
) &optional env &key &allow-other-keys) ¶sequence
) (s2 sequence
) &optional env &key &allow-other-keys) ¶vector
) (bs vector
) &optional env &key &allow-other-keys) ¶array
) (a symbol
) &optional env &key &allow-other-keys) ¶symbol
) (b array
) &optional env &key &allow-other-keys) ¶symbol
) &optional env &key &allow-other-keys) ¶symbol
) b &optional env &key &allow-other-keys) ¶symbol
) (b symbol
) &optional env &key &allow-other-keys) ¶string
) (a symbol
) &optional env &key &allow-other-keys) ¶symbol
) (b string
) &optional env &key &allow-other-keys) ¶string
) (b string
) &optional env &key case-sensitive &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.
character
) (b character
) &optional env &key case-sensitive &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.
number
) (b number
) &optional env &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.
list
) (b list
) &optional env &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.
list
) (a symbol
) &optional env &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.
symbol
) (b list
) &optional env &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.
number-template
) &key spec &allow-other-keys) ¶number-template
) &key spec &allow-other-keys) ¶environment
) stream) ¶asdf-system-definition-file
) (s module
)) ¶asdf/component
.
simple-error
.
This is the condition that is signaled
unbound-variable
.
The ENVIRONMENT structure.
The data structure containing the associations (bindings) between variables and values.
structure-object
.
list
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.
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 <shape-template>)
</pre>
<pre>
#T(<CL array type specifier> <shape-template>)
</pre>
<pre>
#T(array ([* | <CL type specifier>] [<dimension spec>]) <shape-template>)
</pre>
Where <shape-template> can be:
<pre>
<shape-template> ::= <sequence-template>
| <destructuring template lambda list>
| (<shape-template>)
</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 <shape-template>. Each row of the
array is unified recursively against each element of the
<shape-template>.
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><shape-template></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.
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.
elt-template-p
.
unify
.
unify
.
unify
.
unify
.
The EXPRESSION-TEMPLATE Class.
This class is the root of the ’expression template’ sub-hierarchy.
The TEMPLATE Class.
The root of the hierarchy of template objects.
collect-template-vars
.
make-load-form
.
occurs-in-p
.
print-object
.
template-p
.
(setf template-spec)
.
template-spec
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
unify
.
Initarg | Value |
---|---|
:spec | nil |
(or symbol cons)
:spec
The SUBSTITUTION type.
The type representing the associations between variables and values.
Notes:
It is a synonim for the structure type ENVIRONMENT.
Finds a BINDING for a VARIABLE in ENV.
The function returns a BINDING for VARIABLE in ENV, if it finds one.
Otherwise returns NIL.
Arguments and Values:
VARIABLE : a unification variable
ENV : and ENVIRONMENT
result : a BINDING or NIL.
Checks whether a VARIABLE is bound in ENV.
The function returns two values: a BOOLEAN that indicates whether
VARIABLE is bound in ENV and its value if so; otherwise the second
value is NIL.
Arguments and Values:
VARIABLE : a unification variable
ENV : and ENVIRONMENT
bounddp : a BOOLEAN
result : a T
Notes:
IS-VARIABLE-BOUND is almost symmetric to FIND-VARIABLE-VALUE.
lambda-list-parsing-error
)) ¶item
.
lambda-template
)) ¶list-template
)) ¶symbol
) pat env) ¶symbol
) (pat character
) env) ¶symbol
) (pat number
) env) ¶symbol
) (pat string
) env) ¶symbol
) (pat vector
) env) ¶symbol
) (pat array
) env) ¶symbol
) (pat null
) env) ¶symbol
) (pat list
) env) ¶symbol
) (pat symbol
) env) ¶plist-template
)) ¶sequence-template
)) ¶string-template
)) ¶subseq-template
)) ¶type-template
)) ¶vector-template
)) ¶program-error
.
:item
This slot is read-only.
Condition thrown by ’match’ forms.
The condition UNIFICATION-FAILURE is thrown by ’match’ forms when it
can be established that there are other possible unifications for a
template.
simple-error
.
structure-object
.
it.unimib.disco.ma.cl.ext.dacf.unification::bindings
This slot is read-only.
t
This slot is read-only.
cl-source-file
.
Jump to: | (
A B C D E F G I K L M N O P R S T U V |
---|
Jump to: | (
A B C D E F G I K L M N O P R S T U V |
---|
Jump to: | *
B D E F I K N S T |
---|
Jump to: | *
B D E F I K N S T |
---|
Jump to: | A B C E F I K L M N O P R S T U V |
---|
Jump to: | A B C E F I K L M N O P R S T U V |
---|