CL Unification: Class NTHCDR-TEMPLATE
 

Class NTHCDR-TEMPLATE

Package:

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

Class Precedence List:

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

Known Subclasses:

None.

Slots:

None.

Description:

The NTHCDR-TEMPLATE class denotes those object that are used to unify against a particular CONS of a LIST.

Template Syntax:

  #T(nthcdr index item)
  

The NTHCDR-TEMPLATE syntax denotes the CONS item at index a LIST. A NTHCDR-TEMPLATE must be unified against a LIST object. item is unified against the element extracted from the LIST object at index by the standard function NTHCDR.

Examples:

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

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


  cl-prompt> (setq e (unify #(a s d) #T(nthcdr 1 ?x)))
  --> Error: UNIFICATION-FAILURE
  

Affected By:

None.

Exceptional Situations:

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

See Also:

UNIFY

Notes:

None.