[plt-scheme] question about rnrs/enums-6
On Sun, Jan 18, 2009 at 8:09 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>> Anyway, I'll probably forget enums, because order doesn't make difference to
>> me. I could use symbols, with possibility to check things like this:
>>
>> (define (my-enum? e) (or (eq? e 'a) (eq? e 'b) (eq? e 'c)))
>>
>> What would be "the proper", most idiomatic way to handle this
>> situation anyway?
>
> I'd write
>
> (define (my-enum? e) (memq e '(a b c)))
Or, if you are only using it in a error check somewhere, you might
consider contracts, where you can write:
(or/c 'a 'b 'c)
Robby