| dict_add() | dict_contains() | dict_del() |
| dict_keys() | dict_union() | dict_values() |
dict_add()
DICTIONARY dict_add(DICTIONARY dict, ANY key, ANY value)
This function adds an association to the dictionary dict. The key and value of the association are given as the key and value arguments. The new dictionary is returned. If key already exists in dict, then the value of the existing key is replaced with value.
dict_add(#[["foo", "bar"]], 3, 'baz)
=> #[["foo", "bar"], [3, 'baz]]
dict_add(#[["foo", 1], ["bar", 2], ["baz", 3]], "bar", 4)
=> #[["foo", 1], ["bar", 4], ["baz", 3]]
dict_contains()
INTEGER dict_contains(DICTIONARY dict, ANY key)
This function returns 1 if there is an association in dict with the specified key, or 0 otherwise.
dict_contains(#[["foo", "bar"]], "foo")
=> 1
dict_contains(#[["foo", "bar"]], "bar")
=> 0
dict_del()
DICTIONARY dict_del(DICTIONARY dict, ANY key)
This function deletes the key value association from the dictionary dict and returns the result. If there is no association with the specified key, then the error ~keynf is thrown.
dict_del(#[["foo", 1], ["bar", 2]], "foo")
=> #[["bar", 2]]
dict_keys()
LIST dict_keys(DICTIONARY dict)
This function returns a correctly ordered list of the keys of the associations in dict.
dict_keys(#[["foo", 1], ["bar", 2], ['baz, 3]])
=> ["foo", "bar", 'baz]
dict_union()
DICTIONARY dict_union(DICTIONARY dict1, DICTIONARY dict2)
This function merges the two dictionaries by adding each association from dict2 into dict1. In the case of conflicts, the values in dict2 take precedence.
dict_union(#[["foo", 1], ['baz, 3]], #[["foo", 2], ["bar", 2]])
=> #[["foo", 2], ['baz, 3], ["bar", 2]]
dict_values()
LIST dict_values(DICTIONARY dict)
This function returns a correctly ordered list of the keys of the associations in dict.
dict_values(#[["foo", 1], ["bar", 2], ['baz, 3]])
=> [1, 2, 3]