[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Re: Stupid backquote/unquote question
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Re: Stupid backquote/unquote question |
Date: |
Fri, 22 Feb 2008 10:04:38 +0100 |
On Thu, Feb 21, 2008 at 4:39 PM, Hans Nowak <address@hidden> wrote:
>
> I guess I'll have to use eval, but I don't think it's going to work if I use
> this kind of s-expr inside a function? Like
>
> (define (blah x)
> (sasm (jmp ,x)))
>
> (where SASM is the name of the macro that handles this kind of
> s-expressions).
>
This should work:
#;1> (define-macro (foo x) (list 'quasiquote x))
#;2> (foo 33)
33
#;3> (foo (3 + 4 is ,(+ 3 4)))
(3 + 4 is 7)
#;4>
You macro can for example expand into a call to a function
that does the actual processing of the (implicitly) quasiquoted
argument.
cheers,
felix