Dictionary Look Up
check_determ
domains
key = symbol
value = integer
tree = reference dict(key, value, tree, tree)
predicates
lookup(key, tree, value)
clauses
/* lookup(X, Y, Z) is true if the entry X in the sorted tree Y has */
/* data Z. Entries can be added, queried or verified. */
lookup(Key, dict(Key, Value, _, _), Value):-
!.
lookup(Key, dict(Key1, _, Left, _), Value):-
Key < Key1, !, lookup(Key, Left, Value).
lookup(Key, dict(Key1, _, _, Right), Value):-
Key > Key1, lookup(Key, Right, Value).
Turbo Prolog Index
Home Page