Class SUBSEQ-TEMPLATE
Package:
COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION
Class Precedence List:
SUBSEQ-TEMPLATE, ELEMENT-TEMPLATE, EXPRESSION-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.
Known Subclasses:
None.
Slots:
None.
Description:
The SUBSEQ-TEMPLATE class denotes those object that are used to unify against a particular element of an ARRAY.
Template Syntax:
#T(subseq start end . <destructuring template lambda list>)
The SUBSEQ-TEMPLATE syntax is used to unify the elements of a SEQUENCE starting from start and below end, against the <destructuring template lambda list>.
start and end must be supplied and must be valid sequence indexes, i.e. most likely, FIXNUMs; however, end can also be NIL, in which case the usual SUBSEQ semantics applies.
Examples:
cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(subseq 2 4 ?x ?y))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 T cl-prompt> (find-variable-value '?y e) 3 T cl-prompt> (setq e (unify #(0 1 42 3 4 5) #T(subseq 0 4 42 ?x))) --> Error: UNIFICATION-FAILURE cl-prompt> (setq e (unify "This is a string!" #T(subseq 4 nil &rest ?str))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?str e) " is a string!"
Affected By:
None.
Exceptional Situations:
Unifying an SUBSEQ-TEMPLATE against a non-SEQUENCE object results in an UNIFICATION-FAILURE error being signaled.
See Also:
UNIFY
Notes:
None.