make-enumeration(3scm)
π make-enumeration β create a new enumeration type
okay bestie, welcome to make-enumeration(3scm) from the Scheme Programmer's Manual, we're gonna get you sorted β¨
π NAME
make-enumeration β create a new enumeration type. that's it. that's the whole job. iconic honestly.
π LIBRARY
so like, this is an R6RS girlie, and you can pull it in two ways:
(import (rnrs)) ;R6RS
(import (rnrs enums)) ;R6RS
either one, slay π
β¨ SYNOPSIS
(make-enumeration symbol-list)
one argument, one job, no drama.
π¦ DESCRIPTION
okay so here's the tea: make-enumeration creates a brand new enumeration type whose universe is made up of the symbols in symbol-list. and then β plot twist β it hands you back that universe as an enumeration set whose universe is itself, and whose enumeration type is the shiny new enumeration type it just made. main character energy fr fr π
the canonical order of the symbols? that's just the order they show up in first in the list. first appearance wins, periodt. no alphabetical nonsense, no sorting, we respect the debut order π
πΈ RETURN VALUES
returns a single value: an enumeration set. one value. that's it. lowkey refreshing π
π EXAMPLES
watch the duplicate t's and a's get filtered like they're not invited:
(enum-set->list (make-enumeration '(g a t t a c a)))
=> (g a t c)
see? g, a, t, c β first appearances only, in order. ate and left no crumbs π₯
π APPLICATION USAGE
enumeration types are for expressing sets of flags β y'know, like in, e.g., file-options(7scm). ngl though, the syntax define-enumeration(7scm) is the one people actually reach for more commonly. so like, know this one exists, but don't be surprised if the other one's the one on everyone's feed π
π COMPATIBILITY
enumerations are unique to R6RS β nobody else has them, so don't go looking. the (r6rs enums) package over at https://snow-fort.org/ provides a compatible library if you need one π«Ά
π ERRORS
this procedure can raise exceptions with these condition types:
&assertion(R6RS) β the wrong number of arguments got passed, or an argument was outside its domain. in particular,symbol-listhas to be a list of symbols. like, actually. a list. of symbols. no cap π¨
π SEE ALSO
define-enumeration(7scm)β go say hi, she's the popular one
β STANDARDS
R6RS. that's the standard, that's the whole standard, we love a one-liner π
πΈ HISTORY
enumerations first appeared in R6RS. that's their origin story. short, sweet, iconic β¨
π AUTHORS
this page is part of the scheme-manpages project. it includes materials from the RnRS documents. more info lives at https://github.com/schemedoc/manpages/ π§
okay that's the whole page bestie, you're literally an enumeration expert now π this was make-enumeration(3scm), from the Scheme Programmer's Manual, dated 2023-08-27 β go forth and build your universes πβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms