This module provides a
This module provides the same interface as the
Dictionary as returned by
Appends a new
See also section
Appends a list of values
See also section
Erases all items with a given key from a dictionary.
Returns the value associated with
See also section
Returns a list of all keys in dictionary
This function returns value from dictionary and a
new dictionary without this value.
Returns
Searches for a key in dictionary
See also section
Calls
Converts the
Returns
Tests if
Calls
Merges two dictionaries,
merge(Fun, D1, D2) ->
fold(fun (K, V1, D) ->
update(K, fun (V2) -> Fun(K, V1, V2) end, V1, D)
end, D2, D1).
Creates a new dictionary.
Returns the number of elements in dictionary
Stores a
Converts dictionary
Updates a value in a dictionary by calling
Updates a value in a dictionary by calling
append(Key, Val, D) ->
update(Key, fun (Old) -> Old ++ [Val] end, [Val], D).
Adds
This can be defined as follows, but is faster:
update_counter(Key, Incr, D) ->
update(Key, fun (Old) -> Old + Incr end, Incr, D).
Functions
> D0 = dict:new(), D1 = dict:store(files, [], D0), D2 = dict:append(files, f1, D1), D3 = dict:append(files, f2, D2), D4 = dict:append(files, f3, D3), dict:fetch(files, D4). [f1,f2,f3]
This saves the trouble of first fetching a keyed value, appending a new value to the list of stored values, and storing the result.
Function