remove(T, k) removes the entry of T stored under the key k.
i1 : T = new MutableHashTable from {a => 1, b => 2, c => 3}; peek T o2 = MutableHashTable{a => 1} b => 2 c => 3 |
i3 : remove(T, a) |
i4 : peek T o4 = MutableHashTable{b => 2} c => 3 |
If T is not a mutable hash table, an error is thrown. One way to remove an entry from an immutable hash table is with the function applyPairs:
i5 : T = new HashTable from {a => 1, b => 2, c => 3} o5 = HashTable{a => 1} b => 2 c => 3 o5 : HashTable |
i6 : T = applyPairs(T, (k, v) -> if k =!= a then (k, v)) o6 = HashTable{b => 2} c => 3 o6 : HashTable |
The remove command does not return any output.
The object remove is a compiled function.