[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: local syntax-rules
From: |
Lars J. Aas |
Subject: |
Re: local syntax-rules |
Date: |
Mon, 6 Nov 2000 19:27:59 +0100 |
User-agent: |
Mutt/1.2.5i |
On Mon, Nov 06, 2000 at 05:14:08PM +0100, Lars J. Aas wrote:
: (define-syntax argtypes
: (let-syntax ((argtype (syntax-rules ()
: ((argtype (name type)) type)
: ((argtype name) <top>))))
: (syntax-rules ()
: ((argtypes arg) (cons (argtype arg) '()))
: ((argtypes arg arg1 ...) (cons (argtype arg) (argtypes arg1 ...))))))
:
: Should I use let-syntax in another way (e.g. *inside* the argtypes
syntax-rules)?
I found putting them inside the rules to work:
(define-syntax argtypes
(syntax-rules ()
((argtypes arg)
(let-syntax ((argtype (syntax-rules ()
((argtype (name type)) type)
((argtype name) <top>))))
(cons (argtype arg) '())))
((argtypes arg arg1 ...)
(let-syntax ((argtype (syntax-rules ()
((argtype (name type)) type)
((argtype name) <top>))))
(cons (argtype arg) (argtypes arg1 ...))))))
However, this makes me have to repeat the submacros for each public syntax-rule,
making the whole thing an unreadable mess. Isn't a shared approach (like the
invalid example on top) possible? I tried to enclose the syntax rules through
let-variables, but that didn't work either:
(define-syntax argtypes
(let ((argtype-rules (syntax-rules ()
((argtype (name type)) type)
((argtype name) <top>))))
(syntax-rules ()
((argtypes arg)
(let-syntax (argtype argtype-rules)
(cons (argtype arg) '())))
((argtypes arg arg1 ...)
(let-syntax (argtype argtype-rules)
(cons (argtype arg) (argtypes arg1 ...)))))))
Any suggestions? I'll rather use public sub-macros than the let-syntax approach
I found to work...
Lars J