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: Andy Wingo
Subject: Re: Need help with a macro
Date: Sun, 15 Nov 2009 19:18:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hello,

On Sun 15 Nov 2009 17:33, Josef Wolf <address@hidden> writes:

> Hello,
>
> 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:
>
>   ;;; Helper to visualize
>
>   (define-macro (disp exp)
>     (display exp)   (newline)
>     `(display ,exp)
>   ;  (newline)  (newline)
>   )

Does the little schemer book actually use defmacro?

Anyway the issue is that defmacro needs to return Scheme code as an
s-expression. The last expression in a function is its return value.
That would be the `(display ,exp) bit there. But if you uncomment the
newlines, well, you return whatever newline returns, which is actually
unspecified.

Good luck,

Andy
-- 
http://wingolog.org/




reply via email to

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