Reduce the elements of a tree by a combining function to a single value.
List of Import References :
See BOOL
See DENOTATION
See Nat
See Option
See Seq
See Tree
SIGNATURE TreeReduce[from, to]
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
IMPORT Tree[from] ONLY tree
from
is the data type of the elements of the tree,
from
is the result type of the combining function.
SORT from to
The functions takes the root value and the result of reducing the
left and right subtrees respectively. The initial to
value is
returned for the empty tree.
FUN / : (from ** to ** to -> to) ** to ** tree[from] -> to
The following functions are more similar to the reduce
function on sequences, as the function takes one from
and one
to
value. For remembering the names, keep in mind that
(::, <>) /_
order t
constructs are order
traversal of the tree, where order is one of { in
,
pre
or post
.
FUN /_pre /_in /_post: (from ** to -> to) ** to ** tree[from] -> to
next node: TreeZip,
prev node: TreeMapEnv,
up to node: Subsystem Binary Trees