chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Help with writing a macro


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

Hello everyone,

I'm trying to write the following macro using the syntax-rules system, and got stuck trying to figure out the ellipsis. Would someone mind giving me a hand with this? I really appreciate it.

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

And here's my attempt at it:
(define-syntax temp
  (syntax-rules ()
    ((temp args fs ...) (do (fs args ...) ...))))

Obviously it doesn't work, as the ellipsis are not balanced on both sides. I think I might need some sort of helper macro, but don't know what.

Thanks for your help!
  -Patrick

reply via email to

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