[plt-scheme] Re (modified): macros that expand into LISTS OF top-level definitions with computed names

From: Lee Spector (lspector at hampshire.edu)
Date: Fri Aug 14 15:10:12 EDT 2009

That does help insofar as it tells me that the key to iteration in  
macro expansion (to use the CL terminology) seems to be the ellipsis,  
which is new to me and seems pretty interesting. I'll still have to  
figure out how to combine this with the symbol-merging code and figure  
out how to do this with the list of types defined separately... all of  
which is resisting my initial attempts, I guess because I still  
haven't wrapped my head around PLT syntax object concepts.

Thanks again,

  -Lee

On Aug 14, 2009, at 11:54 AM, Matthias Felleisen wrote:

>
> 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

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/



Posted on the users mailing list.