[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Help with writing a macro
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] Help with writing a macro |
Date: |
Mon, 21 Mar 2011 04:36:45 +0100 |
2011/3/21 Patrick Li <address@hidden>:
> [...]
> 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.
> [...]
Hello Patrick,
in that case I'm afraid you have to use some sort of helper macro or
recursive definition, given the current implementation of syntax-rules
in CHICKEN. Try something like this:
(define-syntax temp
(syntax-rules ()
[(temp (arg ...) command)
(command arg ... some-more-args)]
[(temp args command ...)
(do (temp args command) ...)]))
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.