Any key can be mapped to any value, and both can be anything (integer|atom|string|[nested]sequence, including 0|NULL).
By default, all keys and values are entered into one central dictionary, which works as if new_dict() had returned 1.
You can create multiple dictionaries by calling integer tid=new_dict(), and pass that as an additional (final) parameter to the other routines (taking care not to miss any).
Internally, dictionaries are based on a self-balancing binary search tree; see also demo\rosetta\AVL_tree.exw for a slightly longer but perhaps more readable version of the code in builtins\dict.e.
new_dict | - | create a separate and independant sub-dictionary. |
destroy_dict | - | completely remove a dictionary, including all key and data pairings it contains. |
setd | - | add a {key,data} pairing to the dictionary. |
setd_default | - | change the default value (initially NULL) for missing keys. |
getd | - | retrieve the data corresponding to the specified key. |
getd_index | - | retrieve the node index corresponding to the specified key. |
getd_by_index | - | retrieve the data corresponding to the specified node index (from getd_index). |
deld | - | delete a {key,data} pairing from the dictionary. |
traverse_dict | - | perform an in-order traversal, invoking the specified routine for each {key,data} pairing. |
map | - | partial compatibility for OpenEuphoria’s std\map.e |