crow/col/set.crow (source)
set[t] record
(has non-public fields)
Immutable unsorted set.
new[t] t set(...a t array) t key
keySet containing the given elements (with duplicates removed).
to[t] t set(a t array) t key
keySet containing the given elements (with duplicates removed).
to[t] t array(a t set) t key
keyCopies set elements to a list.
is-empty[t] bool(a t set) t key
keytrue iff a.size == 0.
size[t] nat64(a t set) t key
keyNumber of elements in the set.
in[t] bool(value t, a t set) t key
keytrue iff value is an element of a.
subscript[t] bool(a t set, value t) t key
keyAlternative way of writing 'value in a'
~[t] t set(a t set, value t) t key
keyAdds an element to the set.
If value is alerady in the set, returns a unmodified.
~~[t] t set(a t set, b t set) t key
keySame as a | b.
|[t] t set(a t set, b t set) t key
keyUnion of two sets.
This is a set containing all elements in either a or b.
&[t] t set(a t set, b t set) t key
keyIntersection of two sets.
This is a set containing all elements in both a and b.
-[t] t set(a t set, b t set) t key
keySet difference.
This is a set containing all elements in a but not in b.
try-add[t] t set?(a t set, value t) t key
keyIf value is already in the set, returns an empty option.
Else, adds it and returns the new set.
iterate[t] bool(a t set, f mut bool(t)) t key
keyset-builder[t] record mut
(has non-public fields)
build[t] t set(a build-options, f mut void(t set-builder)) t key
key~=[t] void(a t set-builder, value t) t key
key~~=[t, col] void(a t set-builder, values col) t key, (col, t) iterate
keyiterate