[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

#### 7.6.2.24 rnrs enums

The `(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 section Set Operations on Lists, for
more information.

- Scheme Procedure:
**make-enumeration***symbol-list* Returns a new enum-set whose universe and enumeration set are both equal to

`symbol-list`, a list of symbols.

- Scheme Procedure:
**enum-set-universe***enum-set* Returns an enum-set representing the universe of

`enum-set`, an enum-set.

- Scheme Procedure:
**enum-set-indexer***enum-set* Returns a procedure that takes a single argument and returns the zero-indexed position of that argument in the universe of

`enum-set`, or`#f`

if its argument is not a member of that universe.

- Scheme Procedure:
**enum-set-constructor***enum-set* 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.

- Scheme Procedure:
**enum-set->list***enum-set* 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`.

- Scheme Procedure:
**enum-set-member?***symbol enum-set* - Scheme Procedure:
**enum-set-subset?***enum-set1 enum-set2* - Scheme Procedure:
**enum-set=?***enum-set1 enum-set2* These procedures test for membership of symbols and enum-sets in other enum-sets.

`enum-set-member?`

returns`#t`

if and only if`symbol`is a member of the subset specified by`enum-set`.`enum-set-subset?`

returns`#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`.`enum-set=?`

returns`#t`

if and only if`enum-set1`is a subset, as per`enum-set-subset?`

of`enum-set2`and vice versa.

- Scheme Procedure:
**enum-set-union***enum-set1 enum-set2* - Scheme Procedure:
**enum-set-intersection***enum-set1 enum-set2* - Scheme Procedure:
**enum-set-difference***enum-set1 enum-set2* These procedures return, respectively, the union, intersection, and difference of their enum-set arguments.

- Scheme Procedure:
**enum-set-complement***enum-set* Returns

`enum-set`’s complement (an enum-set), with regard to its universe.

- Scheme Procedure:
**enum-set-projection***enum-set1 enum-set2* Returns the projection of the enum-set

`enum-set1`onto the universe of the enum-set`enum-set2`.

- Scheme Syntax:
**define-enumeration***type-name (symbol ...) constructor-syntax* Evaluates to two new definitions: A constructor bound to

`constructor-syntax`that behaves similarly to constructors created by`enum-set-constructor`

, above, and creates new`enum-set`s in the universe specified by`(symbol ...)`

; and a “predicate macro” bound to`type-name`, which has the following form:(

`type-name`sym)If

`sym`is a member of the universe specified by the`symbol`s above, this form evaluates to`sym`. Otherwise, a`&syntax`

condition is raised.

[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated on *April 20, 2013* using *texi2html 5.0*.