chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Re: Stupid backquote/unquote question


From: Hans Nowak
Subject: [Chicken-users] Re: Stupid backquote/unquote question
Date: Fri, 22 Feb 2008 20:07:23 -0500
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

felix winkelmann wrote:
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.

Excellent, that works.  I can now use something like

(define-macro (sasm . body)
  (list 'map 'translate-sasm (list 'quasiquote body)))

Thanks!

--Hans





reply via email to

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