This module provides exactly the same interface as the module
As returned by new/0.
This function appends a new
This function appends a list of values
This function erases all items with a given key from a dictionary.
This function returns the value associated with
This function returns a list of all keys in the dictionary.
This function searches for a key in a dictionary. Returns
Calls
This function converts the
This function tests if
merge(Fun, D1, D2) ->
fold(fun (K, V1, D) ->
update(K, fun (V2) -> Fun(K, V1, V2) end, V1, D)
end, D2, D1).
but is faster.
This function creates a new dictionary.
Returns the number of elements in an
This function stores a
This function converts the dictionary to a list representation.
Update a value in a dictionary by calling
Update a value in a dictionary by calling
append(Key, Val, D) ->
update(Key, fun (Old) -> Old ++ [Val] end, [Val], D).
Add
This could be defined as:
update_counter(Key, Incr, D) ->
update(Key, fun (Old) -> Old + Incr end, Incr, D).
but is faster.
The 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.
The function