- dict-find-update! dto dict key failure successprocedure
This procedure is a workhorse for dictionary lookup, insert, and delete. The dictionary dict is searched for an association whose key is the same as key. If one is not found, then the failure procedure is tail-called with two procedure arguments, insert and ignore.
If such an association is found, then the success procedure is tail-called with the matching key of dict, the associated value, and two procedure arguments, update and delete.
In either case, the values returned by failure or success are returned.
- Invoking (insert value) returns a dictionary that contains all the associations of dict, and in addition a new association that maps key to value.
- Invoking (ignore) has no effects and returns dict unchanged.
- Invoking (update new-key new-value) returns a dictionary that contains all the associations of dict, except for the association whose key is the same as key, which is replaced or hidden by a new association that maps new-key to new-value. It is an error if key and new-key are not the same in the sense of the dictionary’s equality predicate.
- Invoking (delete) returns a dictionary that contains all the associations of dict, except for the association with key key.