[gambit-list] Newbie: define-macro question

Kevin Smith kevin at electricanvil.com
Thu Aug 18 06:31:53 EDT 2005


I'm rather new to Lisp & Scheme (< 3 months total exposure) but I'm 
trying to make a real effort to learn the language. I'm delving into 
macros and having a problem understanding the basics.

I've defined a macro called print-line like so:

(define-macro (print-line msg)
   (list `(display ,msg) `(newline)))

When I try to use the macro from the repl I get the error message:

(print-line "hi")
hi
***ERROR in (console)@38.1 -- Operator is not a PROCEDURE

I do see the output I expect prior to the error so something is 
partially working. I'm certain that the problem is caused by my flawed 
understanding of how macros work. Could someone with more scheme-fu shed 
light on what/where the problem is?

Thanks,
Kevin


More information about the Gambit-list mailing list