Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #140 Delete map entry

Delete from map m the entry having key k.

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

m.remove(k);
(dissoc m k)
m.erase(k);
System.Collections.Generic
map.Remove(key);
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

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org