Did you know ... Search Documentation:
Pack genutils -- prolog/data/env.pl
PublicShow source

This module provides DCG compatible rules for managing a state variable which consistists of an environment, which contains a set of key-value mappings. The predicates do a number of checks to ensure safe and consistant use.

 init_env// is det
Set state to empty environment.
 key_val(?Key, ?Val)// is nondet
Enumerate all keys and associated values.
 get_key(+Key, +Default, ?Val)// is det
Unify Val with value associated with Key or Default if not present.
 get_key(+Key, ?Val)// is det
Unify Val with value associated with Key.
 set_key(+Key, ?Val)// is det
Set value associated with Key to Val.
 upd_key(+Key, ?Val1, ?Val2)// is det
Unify Val1 with value associated with Key and set new value to Val2.
 del_key(+Key)// is det
Remove Key from environment.
 sel_key(+Key, ?Val)// is det
Remove Key from environment and unify Val with its value.
 ins_key(+Key, ?Val)// is det
 ins_key(+Key)// is det
Add Key to environment with given value or unbound if no value given.
 with_key(+Key, :Phrase)// is nondet
Use Phrase to compute new value of key from old.
 with_env(:Phrase) is nondet
Run phrase with initial state equal to an empty environment.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 key(Arg1, Arg2, Arg3)
 ins_key(Arg1, Arg2, Arg3)
 ins_keys(Arg1, Arg2, Arg3)
 sel_keys(Arg1, Arg2, Arg3)