PLOGHELP HASH_TABLE                                     Tom Khabaza,
                                                        13th June 1989.

Library for using hash tables in Prolog.

    :- library(hash_table).

With this package, keys must be atoms or integers.  Values can be any
prolog object.

This library makes available the following predicates:


hash_table(Assoc, Size, H)
    Creates a new hash table.

    Assoc is an initial association list of the form
        [[key1,value1], [key2,value2], ..., [keyN,valueN]]
        May be [] if no initial associations are required,

    Size is the size of the table.  A suitable size might be 20.

    H becomes a new hash table, containing the associations in Assoc.


hash_set(Key, Value, H)
    Sets the value for a given key in hash table H.


hash_get(Key, Value, H)
    Unifies Value with the value for the given key in hash table H.


Example:

    % Make a hash table with some initial associations, and test
    % access and updating:                 

    ?- hash_table([[a,b],[c,d],[e,[hello,world]]], 20, H),                 
       hash_get(a, A1, H),  hash_get(e, E1, H),                 
       hash_set(f, g, H),  hash_get(f, F, H),                 
       hash_set(a, p, H),  hash_set(e, q, H),                 
       hash_get(a, A2, H),  hash_get(e, E2, H).                 
    H = hash_table(20, t([], [], [], [[e | q]], [], [[f | g]], [], [], [],                 
         [], [], [], [], [], [], [[a | p]], [], [], [], [[c | d]]))                 
    A1 = b                 
    E1 = [hello, world]                 
    F = g                 
    A2 = p                 
    E2 = q ? ;                 

    no                 

--- $poplocal/local/plog/help/hash_table
--- Copyright University of Sussex 1989. All rights reserved. ----------
