Essentially, you're calling `foo' during the macro expansion phase. Are you sure you didn't what the macro to *expand* to (foo x) instead? This would work:
(define (foo x) (+ x 1)) (define-macro (bar x) `(foo ,x)) (bar 10)
Otherwise, if you really are asking about the difference between expansion and runtime phases, see the two links Bill Six sent.
- James
On Jan 24, 2009, at 9:42 PM, symbolic expression wrote:
(define (foo x) (+ x 1)) (define-macro (bar x) (foo x)) (bar 10)
this baffles me, if I open up gsi and paste this into the interpreter, I get 11 however, if I stuff this in test.scm and run "gsi test.scm" I get:
*** ERROR IN #<procedure #2>, "test.scm"@2.24 -- Unbound variable: foo
what's going on? how do I fix this?
[I would prefer that code in "gsi test.scm" has the same effect as if I type it into the interpreter]
thanks in advance!
-- -- symbolic expression _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list