crow/col/mut-map.crow (source)
mut-map[k, v] record mut
(has non-public fields)
Mutable unordered map.
Unordered means that iteration functions like each reach each entry in arbitrary order.
new[k, v] k mut[v](...a (k, v) tuple2 array) k key
keyNew map containing the given pairs.
Later pairs overwrite earlier pairs with the same key.
to[k, v] k mut[v](a (k, v) tuple2 array) k key
keyConvert a list of pairs to a map.
Later pairs overwrite earlier pairs with the same key.
to[k, v] k[v](a k mut[v]) k key
keyto[k, v] (k, v) tuple2 array(a k mut[v]) k key
keyCopy pairs to a list.
move-to[k, v] (k, v) tuple2 array(a k mut[v]) k key
keyCopy pairs to a list and clear the map.
move-to[k, v] k[v](a k mut[v]) k key
keymove-to[k, v] k mut[v](a k mut[v]) k key
keycopy[k, v] k mut[v](a k mut[v]) k key
keyCopy pairs to a new map.
is-empty[k, v] bool(a k mut[v]) k key
keytrue iff a.size == 0.
size[k, v] nat64(a k mut[v]) k key
keyNumber of unique keys in the map.
subscript[k, v] v?(a k mut[v], key k) k key
keyGets the value associated with a key.
Returns an empty option if the key is not in the map.
in[k, v] bool(key k, a k mut[v]) k key
keytrue iff the key is in the map.
set-subscript[k, v] void(a k mut[v], key k, value v) k key
keySets the key to the given value, so that a[key] will return value.
If the key is already in the map, this overwrites the previous value.
clear[k, v] void(a k mut[v]) k key
keyRemove all keys, leaving the map empty.
swap[k, v] void(a k mut[v], b k mut[v]) k key
keySet the contents of a to the contents of b and vice versa.
remove[k, v] v?(a k mut[v], key k) k key
keyIf the key was in the map, remove it and return the old value.
Returns an empty option if the key was not in the map.
ensure[k, v] v(a k mut[v], key k, get-value mut v(void)) k key
keyensure[k, v] v(a k mut[v], key k) k key, v new
keynew~=[k, v] void(a k mut[v], anonymous (k, v) tuple2) k key
keyThis is the same as calling a[b a] := b b.
~~=[k, v] void(a k mut[v], pairs (k, v) tuple2 array) k key
keyThis is the same as calling a ~= x for every x in b.
filter=[k, v] void(a k mut[v], f mut bool((k, v) tuple2)) k key
keyFilters 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 k mut[v], f mut v((k, v) tuple2)) k key
keyCalls f on every key and value, and replaces the value with the new value returned by f.
iterate[k, v] bool(a k mut[v], f mut bool((k, v) tuple2)) k key
keyCalls f for every key and value in the map.
build[k, v] k mut[v](a build-options, f mut void(k mut[v])) k key
key