[plt-scheme] question about rnrs/enums-6

From: Luka Stojanovic (ikentobi at yahoo.com)
Date: Sun Jan 18 08:39:02 EST 2009

Hi everyone!

I am learning Scheme for a few week or so, and recently I've tried to make enumerated type: 

  #lang/scheme
  (require rnrs/enums-6)

  (define my-enum1 (make-enumeration '(a b c)))
  ; will cause: make-enumeration: expected argument of type <list of symbols>; given (a b c)

  (define my-enum1 (make-enumeration (a b c)))
 
; will cause (expectedly): reference to an identifier before its definition: a

  (define-enumeration my-enum2 (a b c) my-enum-set)
  ; work as advertised

Am I missing something obvious here, or is this some sort of incompatibility between Module and R6RS?

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?


      


Posted on the users mailing list.