Documentation improvements
- The parameter for .put/1 should be called "NewKeyValuePairs" instead of "New".
| Did you know ... | Search Documentation: |
| Predefined functions on dicts |
Dicts currently define the following reserved functions:
Key1/Key2/.... Each key is
either an atom, small integer or a variable. While Dict.Key
throws an existence error, this function fails silently if a
key does not exist in the target dict. See also :</2,
which can be used to test for existence and unify multiple key values
from a dict. For example:
?- write(t{a:x}.get(a)).
x
?- write(t{a:x}.get(b)).
false.
?- write(t{a:t{b:x}}.get(a/b)).
x
./2
would evaluate. replacing the value associated
with Key in a sub-dict of the dict on which the function
operates. See put_dict/4.
Below are some examples:
?- A = #{}.put(a, 1).
A = #{a:1}.
?- A = #{a:1}.put(a, 2).
A = #{a:2}.
?- A = #{a:1}.put(b/c, 2).
A = #{a:1, b: #{c:2}}.
?- A = #{a: #{b:1}}.put(a/b, 2).
A = #{a: #{b:2}}.
?- A = #{a:1}.put(a/b, 2).
A = #{a: #{b:2}}.
plunit