Your friends here are lambda and pp. Gambit will always expand macros inside a lambda so if you have file x.scm containing : ------------ (define-macro (when test body) `(if ,test (begin ,@body))) (define (foo x) (when (= x 0) (write 'yo))) ------------ you can do the following Gambit v4.0.0
(load "x") "C:\\Jazz\\dev\\jazz\\x.scm" (pp foo) (lambda (x) (if (= x 0) (begin write 'yo)))
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 C:\Jazz\dev\jazz>gsc -debug x C:\Jazz\dev\jazz>gsc Gambit v4.0.0
(load "x") "C:\\Jazz\\dev\\jazz\\x.o1" (pp foo) (##lambda (x) (when (= x 0) (write 'yo)))
Guillaume On 10/26/07, Christopher Diggins <cdiggins@gmail.com> wrote:
I was wondering if anyone could suggest a method of debugging "define-macro" expressions so that I can see what is actually being generated by the macro system (e.g. by preventing evaluation of the resulting macro, and printing it)? Otherwise I get a cryptic messages like "unbound unquote", and "ill-formed expression", but without any hints what is causing the grief in the generated code.
Thanks, Christopher Diggins _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list