chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Re: Macro that changes the structure


From: Daniel Sadilek
Subject: [Chicken-users] Re: Macro that changes the structure
Date: Wed, 13 Jun 2007 14:44:36 +0200

I found a solution:

(define-syntax testsyntax
 (syntax-rules ()
   ((_ ((char digit ...)
        ...))
    `(,(testsyntax 'part (char digit ...))
       ...))
   ((_ 'part (char digit ...))
    '((char digit) ...))))

Are there more elegant solutions? ;)

On 6/13/07, Daniel Sadilek <address@hidden> wrote:
Hello all,

I'm stuck with the following problem. I want a macro that called this way:

(testsyntax
 ((a 1 2)
  (b 3 4)))

Returns this:

(((a 1) (a 2))
 ((b 3) (b 4)))

My bet was:

(define-syntax testsyntax
  (syntax-rules ()
    ((_ ((char digit ...)
         ...))
     '(((char digit) ...)
       ...)))))

But this macro returns:

(((a 1) (b 2))
 ((a 3) (b 4)))

Notice the difference in the characters. The ellipsis just doesn't do
what I want ;)

Can be accomplished what I want with define-syntax? Or do I have to
use defmacro?

Best regards
Daniel Sadilek





reply via email to

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