crow/col/mut-set.crow (source)
mut-set[t] record mut
(has non-public fields)
Mutable unordered set.
new[t] t mut-set(...a t array) t key
keyNew set with the given elements (with duplicates removed).
to[t] t mut-set(a t set) t key
keyCopies an immutable set to a mutable set.
clear[t] void(a t mut-set) t key
keyRemoves all elements.
move-to[t] t array(a t mut-set) t key
keyCopies elements to a list, and clears the a.
move-to[t] t set(a t mut-set) t key
keyCopies elements to an immuttable set, and clears a.
~=[t] void(a t mut-set, value t) t key
keyAdds an element to the set.
Does nothing if value is already in the set.
~~=[t] void(a t mut-set, values t array) t key
keyAdds many elements to the set.
Ignores values already in the set.
in[t] bool(value t, a t mut-set) t key
keytrue iff value is a value in the set.
try-add[t] bool(a t mut-set, value t) t key
keyIf value is already in the set, returns false.
Else, adds it and returns true.
remove[t] bool(a t mut-set, value t) t key
keyIf value is in the set, return false.
Else, remove it and return true.
iterate[t] bool(a t mut-set, f mut bool(t)) t key
key