Remove a missing map key
Updated
Deleting an absent key is a no-op, or a named miss. Size unchanged. Do not throw unless the API says so. Do not delete some other key close to it.
What to focus on
This is the same idea as miss-on-get. Check has-key if you needed to know whether anything happened.
Worked examples
absent among three
a = [4, 1, 9] as {4:2,1:8,9:3}, delete 8- 8 not a key
- map unchanged
Result: {4:2, 1:8, 9:3}
absent one
a = [7] as {7:3}, delete 4- 7 stays
Result: {7:3}
empty
a = [], delete 4- still empty
Result: {}
Try it
Write remove(m, k). m is the hash map. k is absent. Leave m unchanged. Size does not drop. 2 as a value is not key 2. a = [4, 1, 9] as {4:2,1:8,9:3}, delete 8 → {4:2, 1:8, 9:3}. a = [7] as {7:3}, delete 4 → {7:3}. a = [], delete 4 → {}.
keys are integers. The key you delete is absent.