Std.Set
opaque type Set[A]A set of values of type A, ordered by Ord.
fn empty[A]() -> Set[A]The empty set.
from_list
Section titled “from_list”fn from_list[A: Ord](xs: List[A]) -> Set[A]The set of the values of xs.
insert
Section titled “insert”fn insert[A: Ord](s: Set[A], x: A) -> Set[A]s with x.
remove
Section titled “remove”fn remove[A: Ord](s: Set[A], x: A) -> Set[A]s without x.
contains
Section titled “contains”fn contains[A: Ord](s: Set[A], x: A) -> BoolWhether x is in s.
fn size[A](s: Set[A]) -> IntThe number of values.
is_empty
Section titled “is_empty”fn is_empty[A](s: Set[A]) -> BoolWhether the set is empty.
fn fold[A, B](s: Set[A], from: B, f: fn(B, A) -> B fails E(f) uses { R(f) }) -> B fails E(f) uses { R(f) }Folds the values in order, starting from from.
fn each[A](s: Set[A], f: fn(A) -> () fails E(f) uses { R(f) }) -> () fails E(f) uses { R(f) }Calls f on each value in order. Stops at the first failure.
to_list
Section titled “to_list”fn to_list[A](s: Set[A]) -> List[A]The values in order.
filter
Section titled “filter”fn filter[A](s: Set[A], f: fn(A) -> Bool fails E(f) uses { R(f) }) -> Set[A] fails E(f) uses { R(f) }The values for which f is True.
fn union[A: Ord](a: Set[A], b: Set[A]) -> Set[A]The values of both.