While reading my post I noticed that (pp foo) will not have the macros expanded in the compiled version. Of course, the Gambit compiler preserves the copy of the source code *before* doing macro expansions so it is exactly as in the source file. Sorry about that. Guess what that means is that the interpreter is your other friend ;)
<br><br>
<div><span class="gmail_quote">On 10/26/07, <b class="gmail_sendername">Guillaume Cartier</b> <<a href="mailto:gcartier@jazzscheme.org">gcartier@jazzscheme.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Your friends here are lambda and pp. Gambit will always expand macros inside a lambda so if you have file x.scm containing :</div>
<div> </div>
<div>------------</div>
<div>
<p>(define-macro (when test body)<br>  `(if ,test<br>       (begin<br>         ,@body)))</p>
<p>(define (foo x)<br>  (when (= x 0)<br>    (write 'yo))) </p>
<div>------------</div>
<div> </div>
<div>you can do the following</div>
<p>Gambit v4.0.0</p>
<p>> (load "x")<br>"C:\\Jazz\\dev\\jazz\\x.scm"<br>> (pp foo)<br>(lambda (x) (if (= x 0) (begin write 'yo)))<br>></p>
<div>alternatively, if your code is compiled, I suggest always compiling it with -debug that adds no runtime penalty and keeps the source code so you can do</div>
<div>
<p>C:\Jazz\dev\jazz>gsc -debug x</p>
<p>C:\Jazz\dev\jazz>gsc<br>Gambit v4.0.0</p>
<p>> (load "x")<br>"C:\\Jazz\\dev\\jazz\\x.o1"<br>> (pp foo)<br>(##lambda (x) (when (= x 0) (write 'yo)))<br>></p><span class="sg">
<p>Guillaume<br></p></span></div></div>
<div><span class="e" id="q_115dc9629b0baecc_3">
<div><span class="gmail_quote">On 10/26/07, <b class="gmail_sendername">Christopher Diggins</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:cdiggins@gmail.com" target="_blank">cdiggins@gmail.com
</a>> wrote:</span> 
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I was wondering if anyone could suggest a method of debugging<br>"define-macro" expressions so that I can see what is actually being 
<br>generated by the macro system (e.g. by preventing evaluation of the<br>resulting macro, and printing it)? Otherwise I get a cryptic messages<br>like "unbound unquote", and "ill-formed expression", but without any 
<br>hints what is causing the grief in the generated code.<br><br>Thanks,<br>Christopher Diggins<br>_______________________________________________<br>Gambit-list mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">
Gambit-list@iro.umontreal.ca</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
</a><br><br></blockquote></div><br></span></div></blockquote></div><br>