6.2 Tuples

The module Tuple contains procedures operating on tuples.

IsTuple

{Tuple.is +X ?B}

tests whether X is a tuple.

MakeTuple

{Tuple.make +L +I ?T}

binds T to new tuple with label L and fresh variables at features 1 through I. I must be non-negative, else an error exception is raised.

For example, {MakeTuple L N T} waits until L is bound to a literal, say b, and N is bound to a number, say 3, whereupon T is bound to b(_ _ _).

toArray

{Tuple.toArray +T ?A}

returns an array with bounds between 1 and {Width T}, where the elements of the array are the subtrees of T.

append

{Tuple.append +T1 +T2 ?T3}

returns a tuple with same label as T2. Given that T1 has width i and T2 has width j, T3 will have width i + j, and the first i fields of T3 will be the same as the fields of T1 in their original order, and the fields i + 1 through i + j will be the same as the fields of T2 in their original order.


Denys Duchier, Leif Kornstaedt and Christian Schulte
Version 1.4.0 (20080702)