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
) denotes the
binary tree with label Label and children Left and
get_label/3instead if Index is instantiated.
)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.