(define (foo x) x) (define-macro (bar x) `(+ ,x ,(foo x))) (define (baz x) (bar x))
(load "test")
*** ERROR IN #<procedure #2>, "test.scm"@2.1 -- Unbound variable: foo 1>
I was a little surprised of the result. OTOH:
(define (baz2 x) (bar2 x)) (define-macro (bar2 x) `(+ ,x 2))
fails on (baz2 2) as expected while the reverse works properly.
I don't understand why the eval order does not work for define-macro. Is the behavior an implementation choice? And if so why is it wanted?