Library reference for (c211 tree)
(empty-tree)
=> an empty tree
Create a new empty tree. This is a special tree that signifies the end of a branch and is used for creating leaves.
(leaf value)
=> a tree
Create a new tree storing the given
value
and no subtrees. Identical to (tree value (empty-tree) (empty-tree))
.
(leaf? obj)
=> #t or #f
Test if
obj
is a leaf. Equivalent to (and (tree? obj) (empty-tree? (left-subtree obj)) (empty-tree? (right-subtree obj)))
.
(left-subtree? tree)
=> #t or #f
Returns #t if and only if
tree
is a tree, tree
has a left subtree, and the left subtree of tree
is a non-empty tree.
(right-subtree? tree)
=> #t or #f
Returns #t if and only if
tree
is a tree, tree
has a right subtree, and the right subtree of tree
is a non-empty tree.
(tree value left right)
=> a tree
Create a new tree storing the given
value
and with subtrees left
and right
.