☰

Dictionaries

Author(s): The Ciao Development Team.

This module provides predicates for implementing dictionaries. Such dictionaries are currently implemented as ordered binary trees of key-value pairs.

Usage and interface

Documentation on exports

Usage:dictionary(D)

D is a dictionary.

PREDICATEdictionary/5

Usage:dictionary(D,K,V,L,R)

The dictionary node D has key K, value V, left child L, and right child R.

PREDICATEdic_node/2

Usage:dic_node(D,N)

N is a sub-dictionary of D.

PREDICATEdic_lookup/3

Usage:dic_lookup(D,K,V)

D contains value V at key K. If it was not already in D it is added.

PREDICATEdic_lookup/4

Usage:dic_lookup(D,K,V,O)

Same as dic_lookup(D,K,V). O indicates if it was already in D (old) or not (new).

PREDICATEdic_get/3

Usage:dic_get(D,K,V)

D contains value V at key K. Fails if it is not already in D.

PREDICATEdic_replace/4

Usage:dic_replace(D,K,V,D1)

D and D1 are identical except for the element at key K, which in D1 contains value V, whatever has (or whether it is) in D.

A regular type, defined as follows:
old_or_new(old).
old_or_new(new).

Usage:non_empty_dictionary(D)

D is a non-empty dictionary.

Documentation on imports

This module has the following direct dependencies: