[R6RS] Enumerations proposal pre-draft
William D Clinger
will at ccs.neu.edu
Sun Apr 23 10:54:40 EDT 2006
Mike quoting me:
> > I took the liberty of adding a few features, mainly to
> > show why I think it is better to add new functions than
> > new types.
>
> Could you give a hint as to what features those are exactly?
enum-set-universe and enum-set-subset?. Also notice the
subtle role played by the universe in the specification
of enum-set-subset? and enum-set=?.
> > <type-name> will be a procedure of no arguments that returns symbols
> > that comprise the enumeration type, in the same order as they were
> > specified.
>
> Why isn't <type-name> simply the list itself?
Because the R6RS is not expected to provide any way to
enforce immutability of a list. Furthermore, while both
lists and procedures can be compared in constant time via
eq?, the use of a list might confuse some programmers into
thinking that an equal? comparison would also recognize
the canonical representation of the enumeration type,
which it would not.
> Is this:
>
> > (color-index (color purple)) => 2
> ^^^^^^^^^^^^^
>
> supposed to be 'purple?
Yes. Sorry.
Will
More information about the R6RS
mailing list