[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help to understand a macro
From: |
Andy Wingo |
Subject: |
Re: Need help to understand a macro |
Date: |
Fri, 19 Mar 2010 15:28:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
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.
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
Happy hacking,
Andy
--
http://wingolog.org/
Re: Need help to understand a macro, szgyg, 2010/03/20