chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Help with writing a macro


From: Patrick Li
Subject: Re: [Chicken-users] Help with writing a macro
Date: Sun, 20 Mar 2011 22:41:34 -0400

Hi Thomas,

Your solution does in fact do what I was asking for. The example I gave was just a simplified version of what I want to do. Sorry for being unclear. The following is closer to what I actually need to accomplish:

transform:
(temp (a b c) do-this do-that do-other)

to:
(do (do-this a b c some-more-args)
    (do-that a b c some-more-args)
    (do-other a b c some-more-args))

The dot trick doesn't work in this circumstance.
  -Patrick

On Sun, Mar 20, 2011 at 10:36 PM, Thomas Chust <address@hidden> wrote:
2011/3/21 Patrick Li <address@hidden>:
> [...]
> I'm trying to write a macro that will tranform:
> (temp (a b c) do-this do-that do-other)
> into this:
> (do (do-this a b c)
>     (do-that a b c)
>     (do-other a b c))
> [...]

Try this:

(define-syntax temp
 (syntax-rules ()
   [(temp args command ...)
    (do (command . args) ...)]))

Ciao,
Thomas


--
When C++ is your hammer, every problem looks like your thumb.


reply via email to

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