chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Enum macro proposal


From: Zbigniew
Subject: Re: [Chicken-hackers] Enum macro proposal
Date: Sun, 28 Oct 2007 22:34:36 -0500

OK, I extended define-enum in miscmacros to support resetting the
counter.  Would this suffice?

#;37> ,x (define-enum meta->int int->meta foo bar (baz 5) quux)
(begin
  (define-constant foo 0)
  (define-constant bar 1)
  (define-constant baz 5)
  (define-constant quux 6)
  (define (meta->int sym)
    (case sym ((foo) 0) ((bar) 1) ((baz) 5) ((quux) 6) (else #f)))
  (define (int->meta int)
    (switch int (0 'foo) (1 'bar) (5 'baz) (6 'quux) (else #f))))

On 10/28/07, Zbigniew <address@hidden> wrote:
> A similar macro "define-enum" is available in miscmacros, without the
> capability for setting the counter.  It might be worth extending it to
> support this.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]