[R6RS] SYNTAX-CASE
Manuel Serrano
Manuel.Serrano
Mon Apr 11 06:14:20 EDT 2005
I'm currently working on an alternative proposal for SYNTAX-CASE. Presently,
I have no idea if this effort will yield to something useful or not.
I'm coming to you because I have a though that I would like to share with you.
In Bigloo, I'm using a lot of macros (expanders more precisely) for
optimizing the compiled code. These expanders look like:
(define-expander +
(lambda (x e) ;; x is the form to be macro-expansed, e is an expander
(match-case x
((?-)
0)
((?- (and (? integer?) ?v1) (and (? integer?) ?v2))
(+ v1 v2))
((?- (and (? fixnum?) ?v1) (and (? fixnum?) ?v2))
`(+fixnum ,v1 ,v2))
((?- (and (? flonum?) ?v1) (and (? flonum?) ?v2))
`(+flonum ,v1 ,v2))
((?- ?v1 . ?vs)
`(+ ,(e v2 e) ,(e `(+ , at vs) e))))))
(I'm not pretending that this example is 100% correct, I'm just illustrating).
As far as I understand, such transformations cannot be expressed
using SYNTAX-CASE. Am I wrong?
--
Manuel
More information about the R6RS
mailing list