Merge two structural isomorphic trees to a single one by combining the elements pointwise. Or, split a tree up into two structural isomorphic trees by a splitting function
List of Import References :
See BOOL
See DENOTATION
See Nat
See Option
See Seq
See Tree
SIGNATURE TreeZip[from1, from2, to]
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
IMPORT Tree[from1] ONLY tree Tree[from2] ONLY tree Tree[to] ONLY tree
from1
and from2
are the element types of the two
trees to be merged to a tree of type to
or the result types of
the two trees obtained by splitting a tree of type to
.
SORT from1 from2 to
zip
combines the corresponding values of the nodes by the
argument function. zip
aborts, if the trees are not structural
isomorphic. Two trees are structural isomorphic, if both are
empty or both are non emptyand their left and right children are
structural isomorphic.
FUN zip: (from1 ** from2 -> to) ** tree[from1] ** tree[from2] -> tree[to]
unzip
produces two (structural isomorphic) trees by
splitting the values of the nodes with the function.
FUN unzip: (to -> from1 ** from2) ** tree[to] -> tree[from1] ** tree[from2]
next node: TreeConv,
prev node: TreeReduce,
up to node: Subsystem Binary Trees