[plt-scheme] Playing with macros

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jun 5 13:06:11 EDT 2006

On Jun 5, 2006, at 12:31 PM, Jaime Vargas wrote:

> (define-syntax probe
>   (syntax-rules ()
>     ((probe value) (begin
>                      (printf "~a=~a~n" (quote value) value)
>                      value))))
>
> > (probe (map + (probe '(1 2 3)) '(4 5 6)))

Try

  (define-syntax probe
   (syntax-rules ()
     ((probe value) (let ((val value))
                      (printf "--> ~a=~a~n" (quote value) val)
                      val))))

instead. [I have added --> to the output to clarify where things come 
from.]



Posted on the users mailing list.