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 specified key from a dictionary.
Returns the value associated with
See also section
Returns a list of all keys in a dictionary.
Searches for a key in a dictionary. Returns
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 an
Stores a
Converts a dictionary to a list representation.
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 = orddict:new(), D1 = orddict:store(files, [], D0), D2 = orddict:append(files, f1, D1), D3 = orddict:append(files, f2, D2), D4 = orddict:append(files, f3, D3), orddict: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