Logo

Programming-Idioms

Delete from map m the entry having key k.

Explain what happens if k is not an existing key in m.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
(dissoc m k)
m.erase(k);
System.Collections.Generic
map.Remove(key);
m.remove(k);
Map myMap = {};
myMap.remove(key)
m = Map.delete(m, k)
delete(m, k)
import Data.Map.Strict
import Data.Map.Lazy
delete k m
m.delete(k)
map.remove(k);
m[k]=nil
unset($m[k]);
uses ghashmap;
m.delete(k);
delete $m{$k}; # also succeeds when $k does not exist in %m
m.pop(k, None)
m.delete(k)
use std::collections::HashMap;
m.remove(&k);
m -= k
m - k