This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see IntegerSetsCowan in WG2's repo for R7RS-large.


2015-09-15 00:06:50

Integer set procedures

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.

Procedures without SRFI-13 analogues

(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.

SRFI 113 procedures not in Chicken iset

Not useful: member, element-comparator, comparator, replace, replace!, partition!

Useful: disjoint?, find, count, remove, remove!, partition, set<?, set>?