Library reference for (c211 tree)


(draw-tree tree)
=> unspecified

Displays a graphical representation of 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.

(empty-tree? obj)
=> #t or #f

Test if obj is an empty tree.

(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)
=> a value

Returns the left subtree of a tree.

(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)
=> a value

Returns the right subtree of a 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.

(root-value tree)
=> a value

Gets the value stored in a tree node.

(tree value left right)
=> a tree

Create a new tree storing the given value and with subtrees left and right.

(tree? obj)
=> #t or #f

Test if obj is a tree. Returns #t on either a tree or an empty-tree.