| make-enumeration(3scm) | Scheme Programmer's Manual | make-enumeration(3scm) |
NAME
make-enumeration - create a new enumeration type
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs enums)) ;R6RS
SYNOPSIS
(make-enumeration symbol-list)
DESCRIPTION
Creates a new enumeration type whose universe consists of the symbols in symbol-list and returns that universe as an enumeration set whose universe is itself and whose enumeration type is the newly created enumeration type.
The canonical order of the symbols is according to their first appearance in the list.
RETURN VALUES
Returns a single value; an enumeration set.
EXAMPLES
(enum-set->list (make-enumeration '(g a t t a c a)))
=> (g a t c)
APPLICATION USAGE
Enumeration types are used for expressing sets of flags, as in, e.g., file-options(3scm). The syntax define-enumeration(3scm) is more commonly used.
COMPATIBILITY
Enumerations are unique to R6RS. The (r6rs enums) package at https://snow-fort.org/ provides a compatible library.
ERRORS
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed or an argument was outside its domain. In particular, symbol-list must be a list of symbols.
SEE ALSO
define-enumeration(3scm)
STANDARDS
R6RS
HISTORY
Enumerations first appeared in R6RS.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2023-08-27 |