Module "TableRBT0.curry"

OLD (OBSOLETE) Version of a library with an implementation of tables as red-black trees:

A table is a finite mapping from keys to values. All the operations on tables are generic, i.e., one has to provide an explicit order predicate ("cmp" below) on elements. Each inner node in the red-black tree contains a key-value association.

Author: Johannes Koj, Michael Hanus

Version: May 2001


 Exported names:

Datatypes:
TableRBT

Functions:
emptyTableRBT | lookupRBT | tableRBT2list | updateRBT


 Summary of exported functions:

emptyTableRBT  :: TableRBT a b  deterministic 
          Returns an empty table, i.e., an empty red-black tree.
lookupRBT  :: (a -> a -> Bool) -> a -> TableRBT a b -> Maybe b  deterministic flexible+rigid
          Looks up an entry in a table.
updateRBT  :: (a -> a -> Bool) -> a -> b -> TableRBT a b -> TableRBT a b  deterministic 
          Inserts or updates an element in a table.
tableRBT2list  :: TableRBT a b -> [(a,b)]  deterministic 
          Transforms the nodes of red-black tree into a list.

 Imported modules:

Prelude

 Exported datatypes:

TableRBT

The structure of red-black trees.

Constructors:



 Exported functions:

emptyTableRBT :: TableRBT a b  deterministic 

Returns an empty table, i.e., an empty red-black tree.

Further infos:
  • solution complete, i.e., able to compute all solutions

lookupRBT :: (a -> a -> Bool) -> a -> TableRBT a b -> Maybe b  deterministic flexible+rigid

Looks up an entry in a table.

Example call:  (lookupRBT cmp k t)

Parameters:
cmp - order predicate on keys
k - a key under which a value is stored
t - a table (represented as a red-black tree)
Returns:
(Just v) if v is the value stored with key k, otherwise Nothing is returned.
Further infos:
  • incompletely defined

updateRBT :: (a -> a -> Bool) -> a -> b -> TableRBT a b -> TableRBT a b  deterministic 

Inserts or updates an element in a table. The first argument is the order on elements.


tableRBT2list :: TableRBT a b -> [(a,b)]  deterministic 

Transforms the nodes of red-black tree into a list.

Further infos:
  • solution complete, i.e., able to compute all solutions


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Jun 16 17:15:54 2009