(rnrs enums (6)) library provides structures and procedures
for working with enumerable sets of symbols. Guile’s implementation
defines an enum-set record type that encapsulates a finite set of
distinct symbols, the universe, and a subset of these symbols,
which define the enumeration set.
The SRFI-1 list library provides a number of procedures for performing
set operations on lists; Guile’s
(rnrs enums) implementation
makes use of several of them. See SRFI-1 Set Operations, for
Returns a new enum-set whose universe and enumeration set are both equal to symbol-list, a list of symbols.
Returns an enum-set representing the universe of enum-set, an enum-set.
Returns a procedure that takes a single argument and returns the
zero-indexed position of that argument in the universe of
#f if its argument is not a member of that
Returns a procedure that takes a single argument, a list of symbols from the universe of enum-set, an enum-set, and returns a new enum-set with the same universe that represents a subset containing the specified symbols.
Returns a list containing the symbols of the set represented by enum-set, an enum-set, in the order that they appear in the universe of enum-set.
These procedures test for membership of symbols and enum-sets in other
#t if and only if
symbol is a member of the subset specified by enum-set.
#t if and only if the universe of
enum-set1 is a subset of the universe of enum-set2 and
every symbol in enum-set1 is present in enum-set2.
#t if and only if enum-set1 is a
subset, as per
enum-set-subset? of enum-set2 and vice
These procedures return, respectively, the union, intersection, and difference of their enum-set arguments.
Returns enum-set’s complement (an enum-set), with regard to its universe.
Returns the projection of the enum-set enum-set1 onto the universe of the enum-set enum-set2.
Evaluates to two new definitions: A constructor bound to
constructor-syntax that behaves similarly to constructors created
enum-set-constructor, above, and creates new enum-sets
in the universe specified by
(symbol ...); and a “predicate
macro” bound to type-name, which has the following form:
If sym is a member of the universe specified by the symbols
above, this form evaluates to sym. Otherwise, a
condition is raised.