Class NTH-TEMPLATE
Package:
COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION
Class Precedence List:
NTH-TEMPLATE, ELEMENT-TEMPLATE, EXPRESSION-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.
Known Subclasses:
None.
Slots:
None.
Description:
The NTH-TEMPLATE class denotes those object that are used to unify against a particular element of a LIST.
Template Syntax:
#T(nth index item)
The NTH-TEMPLATE syntax denotes the item at index a LIST. A NTH-TEMPLATE must be unified against a LIST object. item is unified against the element extracted from the sequence object at index by the standard function NTH.
Examples:
cl-prompt> (setf e (unify '(0 1 42 3 4 5) #T(nth 2 ?x))) #<ENVIRONMENT xxx> cl-prompt> (find-variable-value '?x e) 42 cl-prompt> (setq e (unify '(0 1 42 3 4 5) #T(nth 42 ?x))) --> Error: index 42 out of bounds. FIX THIS cl-prompt> (setq e (unify #(a s d) #T(nth 1 ?x))) --> Error: UNIFICATION-FAILURE
Affected By:
None.
Exceptional Situations:
Unifying an NTH-TEMPLATE against a non-LIST object results in an UNIFICATION-FAILURE error being signaled.
See Also:
UNIFY
Notes:
None.