define-enum-constants-from-zero for enumerations wirhout explicit numbers.
This commit is contained in:
parent
84684372ce
commit
73b9c41bbb
|
@ -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 ...)))))
|
||||||
|
|
Loading…
Reference in New Issue