[ Third Party Libraries | Reference Manual | Alphabetic Index ]

# library(m_tree234)

A map (dictionary) implemented using 2-3-4 trees

## Predicates

> assoc_list_to_tree234(+AssocList, -Tree)
>   Converts an association list into a tree.
> count(+Tree, ?Count)
>   Count the number of elements in a tree.
> delete(+Tree0, ++Key, -Tree)
>   Delete a key/value pair from a tree.
> init(-Tree)
>   Initialise a new (empty) 2-3-4 tree.
> insert(+Tree0, ++Key, ?Value, -Tree)
>   Insert a key/value pair into a tree, failing if the key already exists.
> is_empty(+Tree)
>   Check whether a tree is empty.
> keys(+Tree, -KeyList)
>   Return all the keys from a tree.
> lookup(+Tree, ++Key, ?Value)
>   Search a tree for a key.
> lower_bound_lookup(+Tree, ++SearchKey, ?Key, ?Value)
>   Search a tree for the smallest key no smaller than SearchKey.
> lower_bound_search(+Tree, ++SearchKey, ?Key, ?Value)
>   Search a tree for the smallest key no smaller than SearchKey.
> member(+Tree, ?Key, ?Value)
>   Succeeds if Key and Value unify with a key/value pair from Tree.
> remove(+Tree0, ++Key, ?Value, -Tree)
>   Remove a key/value pair from a tree, failing if the key is not present.
> remove_smallest(+Tree0, ?Key, ?Value, -Tree)
>   Remove the smallest key and its corresponding value from a tree.
> search(+Tree, ++Key, ?Value)
>   Search a tree for a key.
> set(+Tree0, ++Key, ?Value, -Tree)
>   Update the value corresponding to a key in a tree, inserting the key if it doesn't exist already.
> tree234_to_assoc_list(+Tree, -AssocList)
>   Converts a tree into an association list.
> update(+Tree0, ++Key, ?Value, -Tree)
>   Update the value corresponding to a key in a tree.
> upper_bound_lookup(+Tree, ++SearchKey, ?Key, ?Value)
>   Search a tree for the largest key no larger than SearchKey.
> upper_bound_search(+Tree, ++SearchKey, ?Key, ?Value)
>   Search a tree for the largest key no larger than SearchKey.
> values(+Tree, -ValueList)
>   Return all the values from a tree.

## Description

This module implements 2-3-4 trees. They can be used to manage and index a collection of key/value pairs. You probably want to use the interface provided by `map.pl' instead of using this module directly.

Note that keys must be ground, but values are allowed to be variables.

## About

- Author: Thomas Conway (Mercury) and Warwick Harvey (ECLiPSe)

Generated from m_tree234.eci on Sat Nov 8 07:00:14 2008