Within Guile, I am trying to learn define-syntax
and syntax-rules
. I was under the impression that scheme macros do not evaluate their arguments, but it seems like mine is doing so:
(define-syntax foo
(syntax-rules ()
((foo word)
(if (eqv? word 'bar) (begin (write "Caller said BAR!") (newline)))
)))
If I call it with (foo bar)
, I get the error message
Unbound variable: bar
Whereas if I call it with (foo 'bar)
, I get the expected
"Caller said BAR!"
This makes it seem as though the argument is getting evaluated prior to application of the macro.