CL Unification: Class ELT-TEMPLATE
 

Class ELT-TEMPLATE

Package:

COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION

Class Precedence List:

ELT-TEMPLATE, ELEMENT-TEMPLATE, EXPRESSION-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.

Known Subclasses:

None.

Slots:

None.

Description:

The ELT-TEMPLATE class denotes those object that are used to unify against a particular element of a SEQUENCE.

Template Syntax:

  #T(elt index item)
  

The ELT-TEMPLATE syntax denotes the element of item at index. An ELT-TEMPLATE must be unified against a SEQUENCE object. item is unified against the element extracted from the sequence object at index by the standard function ELT.

Examples:

  cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(elt 2 ?x)))
  #<ENVIRONMENT xxx>
  
  cl-prompt> (find-variable-value '?x e)
  42

  cl-prompt> (setq e (unify #(0 1 42 3 4 5) #T(elt 42 ?x)))
  --> Error: index 42 out of bounds.


  cl-prompt> (setq e (unify 42 #T(elt 42 ?x)))
  --> Error: UNIFICATION-FAILURE


  cl-prompt> (setq e (unify "This is a string!" #T(elt 4 ?x)))
  #<ENVIRONMENT xxx>

  cl-prompt> (find-variable-value '?x e)
  #\Space  
  

Affected By:

None.

Exceptional Situations:

Unifying an ELT-TEMPLATE against a non-SEQUENCE object results in an UNIFICATION-FAILURE error being signaled.

See Also:

UNIFY

Notes:

None.