ck/set▲toc

Set

.

type setck/set/set: V -> V<a>
fun add( s : setck/set/set: V -> V<a>, value : a, ?cmp : (a, a) -> orderstd/core/types/order: V ) : setck/set/set: V -> V<a>

Add a value to a set. Do nothing if the given value already exists. The time complexity is O(log size).

Check whether a value belongs to a set. The time complexity is O(log size).

Create an empty set.

fun foreach( s : setck/set/set: V -> V<a>, action : (a) -> e () ) : e ()

Iterate over elements in ascending order.

Check whether a set is empty.

Return the maximum element of a set. The time complexity is O(log size).

Return the minimum element of a set. The time complexity is O(log size).

fun remove( s : setck/set/set: V -> V<a>, value : a, ?cmp : (a, a) -> orderstd/core/types/order: V ) : setck/set/set: V -> V<a>

Remove an element from a set. Do nothing if the given value does not exist. The time complexity is O(log size).

fun singleton( v : a ) : setck/set/set: V -> V<a>

Create a set with a single element.

Return the number of key-value pairs. The time complexity is O(1).

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/exnstd/core/exn, std/core/boolstd/core/bool, std/core/orderstd/core/order, std/core/charstd/core/char, std/core/intstd/core/int, std/core/vectorstd/core/vector, std/core/stringstd/core/string, std/core/sslicestd/core/sslice, std/core/liststd/core/list, std/core/maybestd/core/maybe, std/core/maybe2std/core/maybe2, std/core/eitherstd/core/either, std/core/tuplestd/core/tuple, std/core/lazystd/core/lazy, std/core/showstd/core/show, std/core/debugstd/core/debug, std/core/delayedstd/core/delayed, std/core/consolestd/core/console, std/corestd/core