[plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names
On second thought, this example is closer to what you need:
(define-syntax (def-all stx)
(syntax-case stx ()
[(_ type ...)
(with-syntax ([(index ...) (build-list (length (syntax->list
(syntax (type ...)))) add1)])
#`(begin (define-values (type ...) (values index ...))
(register-instruction 'type)
...))]))
(define (register-instruction x) x)
(def-all exec float integer)
exec float integer
On Aug 14, 2009, at 11:44 AM, Matthias Felleisen wrote:
>
> Will this help you along?
>
> #lang scheme
>
> (define-syntax (def-all stx)
> (syntax-case stx ()
> [(_ type ...)
> #`(begin (begin (define type 1)
> (register-instruction 'type))
> ...)]))
>
> (define (register-instruction x) x)
>
> (def-all exec float integer)
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme