unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Need help with a macro
@ 2009-11-15 16:33 Josef Wolf
  2009-11-15 18:18 ` Andy Wingo
  2009-11-15 20:26 ` Neil Jerram
  0 siblings, 2 replies; 5+ messages in thread
From: Josef Wolf @ 2009-11-15 16:33 UTC (permalink / raw)
  To: guile-user

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)
  )

This works great, except that when I uncomment the (newline) expressions,
the result of the evaluation is omitted:

  guile> (define-macro (disp exp)
  ...   (display exp)   (newline)
  ...   `(display ,exp)
  ... ;  (newline)  (newline)
  ... )
  guile> (disp (+ 3 4)) (newline)
  (+ 3 4)
  7
  guile> (define-macro (disp exp)
  ...   (display exp)   (newline)
  ...   `(display ,exp)
  ...   (newline)  (newline)
  ... )
  guile> (disp (+ 3 4)) (newline)
  (+ 3 4)
  
  
  
  guile>

Any hints?




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-16 17:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-15 16:33 Need help with a macro Josef Wolf
2009-11-15 18:18 ` Andy Wingo
2009-11-16 17:40   ` Josef Wolf
2009-11-15 20:26 ` Neil Jerram
2009-11-16 17:20   ` Josef Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).