chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] stressing the new hygienic macros


From: Elf
Subject: Re: [Chicken-users] stressing the new hygienic macros
Date: Tue, 28 Apr 2009 09:28:00 -0700 (PDT)
User-agent: Alpine 2.00 (LRH 1167 2008-08-23)


perhaps the addition of a let-syntax would be useful above the internal syntax-rules?

-elf

On Tue, 28 Apr 2009, Michele Simionato wrote:

I have subscribed again the list after a few years of absence, because I wanted
to try the new and improved hygienic Chicken ;-)
As first experiment, I tried to stress a bit syntax-rules. I tried the following
at the REPL:

(define-syntax very-static-table
 (syntax-rules ()
   ((_ (name value) ...)
     (syntax-rules (<names> name ...)
       ((_ <names>) '(name ...))
       ((_ name) value) ...))))

> (define-syntax color
 (very-static-table (red 0) (green 1) (blue 2)))

Error: unbound variable: red

        Call history:

        <syntax>          (define-syntax color (very-static-table (red 0) 
(green 1) (blue 2)))
        <syntax>          (very-static-table (red 0) (green 1) (blue 2))
        <syntax>          (red 0)
        <syntax>          (green 1)
        <syntax>          (blue 2)
        <eval>            (very-static-table (red 0) (green 1) (blue 2))
        <eval>            (red 0) <--

What's happening here? Notice that

(define-syntax color
 (syntax-rules (<names> red green blue)
   ((_ <names>) '(red green blue))
   ((_ red) 0)
   ((_ green) 1)
   ((_ blue) 2)))

works as intended.


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]