Go to the previous, next section.
This package uses binary trees to represent arrays of N elements
where N is fixed, unlike library(arrays)
. To load the
package, enter the query
| ?- use_module(library(trees)).
Binary trees have the following representation: t
denotes the
empty tree, and t(Label,Left,Right)
denotes the
binary tree with label Label and children Left and
Right.
get_label/3
instead if Index is instantiated.
get_label(K,Tree,Lab)
iff Lab is the
Kth element of List.
list_to_tree/2
. Any mapping or
checking operation can be done by converting the tree to a list, mapping
or checking the list, and converting the result, if any, back to a tree.
Go to the previous, next section.