The elements of an integer set are exact integers. The procedures for creating and manipulating integer sets are the same as those for SRFI 113 sets, except that set
is replaced by integer-set
in their names. However, set-comparator
has no equivalent for integer sets, and in integer-set
, integer-set-unfold
, integer-set-map
, and integer-set-copy
the comparator argument is omitted.
Although sets subsume integer sets, providing them separately allows for increased implementation efficiency. There are two Chicken eggs that provide integer sets: iset
, on which this SRFI is based, which uses bit vectors (and underlying them, bytevectors); and cis
, which uses lists of integer intervals.
(integer-set-min
integer-set)
(integer-set-max
integer-set)
Returns the smallest or largest integer in integer-set, or #f
if there is none.
(integer-set-open-interval
integer-set low high)
(integer-set-closed-interval
integer-set low high)
(integer-set-open-closed-interval
integer-set low high)
(integer-set-closed-open-interval
integer-set low high)
Procedures that return a subset of integer-set contained in the interval from low to high. The interval may be open, closed, open below and closed above, or open above and closed below.
(integer-set-range=
integer-set k)
(integer-set-range<
integer-set k)
(integer-set-range<=
integer-set k)
(integer-set-range>
integer-set k)
(integer-set-range>=
integer-set k)
Procedures that return an integer set containing the elements of integer-set that are equal
to, less than, less than or equal to, greater than, or greater than or equal to k.
Note that the result integer-set-range=
contains at most one element.
(integer-set-delete-min!
integer-set)
(integer-set-delete-max!
integer-set)
Linear update procedures that return two values: the smallest or largest integer in integer-set or #f
if there is none, and a set which contains all the elements of set except the integer being returned.
Not useful: member, element-comparator, comparator, replace, replace!, partition!
Useful: disjoint?, find, count, remove, remove!, partition, set<?, set>?