File "hash"
This Prolog text provides a non-backtracking hash table. The
predicate hash_current/3 allows accessing a value from a hash
table by a key. The predicates hash_set/3 and hash_add/3 are
destructive and modify the hash table via change_arg/3. The
predicate hash_add/4 is non-destructive and returns a hash table.
The following hash table predicates are provided:
- hash_enum(T, P):
- The predicate succeeds in P with the key value pairs from the
hash table T.
- hash_pairs(T, L):
- The predicate succeeds in L with the key value pair list from
the hash table T.
- hash_new(T):
- The predicate succeeds in R with a new hash table.
- hash_size(T, S):
- The predicate succeeds in S with the number of key value pairs
of the hash table T.
- hash_current(T, K, V):
- The predicate succeeds in V with the value for the key K in
the hash table T.
- hash_set(T, K, V):
- The predicate succeeds. As a side effect the hash table T is
extended by the key value pair K,V if the key is new or else the
value for the K is replaced by V.
- hash_add(T, K, V):
- The predicate succeeds if the key is new. As a side effect the
hash table T is extended by the key value pair K,V.
- hash_add(T, K, V, T2):
- The predicate succeeds if the key is new. It unifies T2 with
the hash table T is extended by the key value pair K,V.
Kommentare