[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help to understand a macro
From: |
Josef Wolf |
Subject: |
Re: Need help to understand a macro |
Date: |
Mon, 22 Mar 2010 20:50:25 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Fri, Mar 19, 2010 at 03:28:39PM +0100, Andy Wingo wrote:
> Hi,
>
> On Fri 19 Mar 2010 09:57, Josef Wolf <address@hidden> writes:
>
> > (show-expansion (defstruct tree height girth age leaf-shape leaf-color))
>
> (macroexpand '(defstruct ...))
>
> You might want to surround that with (pretty-print ...) from (ice-9
> pretty-print).
>
> > Of course this is possible. After all, code is data and data is code.
>
> Sorta. Syntax-rules/syntax-case macros operate on syntax objects, not on
> raw s-expressions. This allows them to preserve referential
> transparency. So the result of expansion might not look like what you
> would expect.
Ummm, I just started to hammer this macro thing into my head, so I don't
understand (yet) what you are talking about. I thought the power of lisp
macros comes from the fact that they operate on s-expressions? What are
syntax objects? What is referential transparency?
> Read up on syntax-rules and syntax-case macros, when you get some time.
> I used to love defmacros but I don't use them any more.
>
> http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=doc/ref/api-macros.texi;h=51f54ed070af453a138282f61e7cd8dbbddc53a3;hb=HEAD
Where can I find a version translated in pdf or html or something?
Thanks Andy!
Re: Need help to understand a macro, szgyg, 2010/03/20