guile-user
[Top][All Lists]
Advanced

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

Re: Need help with a macro


From: Josef Wolf
Subject: Re: Need help with a macro
Date: Mon, 16 Nov 2009 18:20:45 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

On Sun, Nov 15, 2009 at 08:26:58PM +0000, Neil Jerram wrote:
> Josef Wolf <address@hidden> writes:
> > I am trying to work through the little schemer book. In order to make it
> > easier to go through the examples, I've come up with the following macro:
> > [ ... ]
> 
> The body of a define-macro definition is supposed to return the code
> that should be substituted in place of the original macro call.  With
> the newlines there, the body returns *unspecified*, because that is what
> (newline) returns.

OK, I think I see the problem now...

> Do you want those newlines to happen at macro-expansion time or eval
> time?  If the latter (which I would guess), the code that you want is
> 
> (define-macro (disp exp)
>   (display exp)   (newline)
>   `(begin
>      (display ,exp)
>      (newline)  (newline)))

Works great. Thanks!




reply via email to

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