define-enum-constants-from-zero for enumerations wirhout explicit numbers.

This commit is contained in:
mainzelm 2001-01-02 14:42:14 +00:00
parent 84684372ce
commit 73b9c41bbb
1 changed files with 15 additions and 0 deletions

View File

@ -33,3 +33,18 @@
(syntax-rules () (syntax-rules ()
((define-enum-constants set (elt val) ...) ((define-enum-constants set (elt val) ...)
(begin (define-enum-constant set elt val) ...)))) (begin (define-enum-constant set elt val) ...))))
(define-syntax define-enum-constants-from-x
(syntax-rules
()
((define-enum-constants-from-zero x set ())
(begin))
((define-enum-constants-from-zero x set (elt1 elt2 ...))
(begin (define-enum-constant set elt1 x)
(define-enum-constants-from-x (+ x 1) set (elt2 ...))))))
(define-syntax define-enum-constants-from-zero
(syntax-rules
()
((define-enum-constants-from-zero set (elt ...))
(define-enum-constants-from-x 0 set (elt ...)))))