[R6RS] Enumerations proposal pre-draft

William D Clinger will at ccs.neu.edu
Thu May 18 15:05:55 EDT 2006


Mike wrote:
> > For <type-name>, how about we make it into a procedure of zero
> > arguments that returns the universe as a set?
> 
> No.  I meant "giving in" in the sense of "accept your proposal, with
> overloading", not doing something else.

Ouch.  May I suggest a different compromise?

How about we flush the <index-of> procedure altogether?
Nothing in the proposal uses it, and it's hard to imagine
any good use for it.  If there were a good use for it, it
could be defined in terms of any subset of the associated
universe via

    (define (make-indexer set)          ; untested
      (let* ((symbols (enum-set->list (enum-set-universe set)))
             (cardinality (length symbols)))
        (lambda (x)
          (let ((probe (memq x symbols)))
            (if probe
                (- cardinality (length probe))
                #f)))))

If we can agree to flush the <index-of> procedure, this
simplification would make it easier for us to agree on
changing the short form to require, or at least to allow,
either the <constructor-syntax> or <constructor>, which
would offer a way to construct a set from the short form
without the overloading of <type-name> that both of us
dislike.

In summary, I am suggesting we:

1.  flush <index-of> altogether
2.  revert <type-name> to your original macro (although
    your draft also referred to it as a procedure and
    used it as such; my repair of that bug was what
    led me to overload <type-name>).
3.  either require or allow the short form to specify
    either <constructor-syntax> or <constructor>.

Comments?

Another issue that needs to be resolved is whether the
<constructor> takes a bunch of symbols as its arguments,
or a list of symbols as its single argument.

Will



More information about the R6RS mailing list