(dict) -> dict
(dict pair ...) -> dict
Returns a dictionary, with the car of each list assigned as the key, and the cdr assigned as the value. To differentiate from lists, the output to the console uses []. However, when giving input the []'s will not be recognized: ()'s must be used.
Internally, MOSVM employs treaps to express dictionaries -- inserting, altering and deleting entries in a dictionary will require O(log n) time.
Examples:
Note that in the last example, the key b was given twice. (b 2) was created, but superseded by (b 3) which came later in the process. In most cases, lists with duplicated cars should therefore be avoided.
It should also be noted that it is possible to have an empty value, seen in the third example above.
Pairs and Lists:
Dict handles dotted pairs and lists differently.
Examples: