keen/col/mut-map

Source
This is a standard module and does not need to be explicitly imported.
mut-map[k, v] record (has private fields)
Mutable unordered map.
list-new[k, v] v mut[k](a (k, v)[]) k key
Later pairs overwrite earlier pairs with the same key.
to[k, v] v mut[k](a (k, v)[]) k key
Convert a list of pairs to a map. Later pairs overwrite earlier pairs with the same key.
to[k, v] v[k](a v mut[k]) k key
Copy to an immutable map.
to[k, v] (k, v)[](a v mut[k]) k key
Copy pairs to an array.
move-to[k, v] (k, v)[](a v mut[k]) k key
Copy pairs to an array and clear the map.
move-to[k, v] v[k](a v mut[k]) k key
move-to[k, v] v mut[k](a v mut[k]) k key
copy[k, v] v mut[k](a v mut[k]) k key
Copy pairs to a new mut-map.
is-empty[k, v] bool(a v mut[k]) k key
true if a.size == 0.
size[k, v] nat64(a v mut[k])
Number of pairs in the map.
subscript[k, v] v option(a v mut[k], key k) k key
Gets the value associated with a key. Returns an empty option if key is not in the map.
set-subscript[k, v] void(a v mut[k], key k, value v) k key
Sets the key to the given value, so that a[key] will return value. If the key was already in the map, this overwrites the previous value.
clear[k, v] void(a v mut[k]) k key
Removes all pairs, leaving the map empty.
swap[k, v] void(a v mut[k], b v mut[k]) k key
Set the contents of a to the contents of b and vice versa. This is O(1).
remove[k, v] v option(a v mut[k], key k) k key
If the key is in the map, removes it and returns the associated value.
ensure[k, v] v(a v mut[k], key k, get-value v mut(void)) k key
Ensures that a key is the map. If the key is already in the map, does nothing and returns the associated value. Otherwise, sets the value to get-value[] and returns that.
ensure[k, v] v(a v mut[k], key k) k key, v new
~=[k, v] void(a v mut[k], (key k, value v)) k key
This is the same as calling a[key] := value. Prefer to write it that way instead.
~~=[k, v] void(a v mut[k], pairs (k, v)[]) k key
filter=[k, v] void(a v mut[k], f bool mut((k, v))) k key
Filters the map in place. Calls f on every key and value and removes the key if f returns false.
map-values=[k, v] void(a v mut[k], f v mut((k, v))) k key
Calls f on every key and value, and replaces the value with the new value returned by f. Does not modify keys.
keys[k, v] k[](a v mut[k]) k key
values[k, v] v[](a v mut[k]) k key
some[k, v] bool(a v mut[k], f bool mut((k, v))) k key
mut-map-unsorted[k, v] record (has private fields)
unsorted[k, v] (k, v) mut-map-unsorted(a v mut[k]) unsafe
size[k, v] nat64(a (k, v) mut-map-unsorted)
some[k, v] bool(a (k, v) mut-map-unsorted, f bool mut((k, v))) unsafe