| I am working on a set of test cases for the foundation of Arc - simply a bunch of expressions associated with their expected values. But testing macros is trickier than I had thought. If I run these two lines one after the other at the REPL, I get a result: arc> (set my-plus (annotate 'mac (fn (x y) `(+ ,x ,y))))
arc> (my-plus 19 71)
90
But if I run this (after restarting arc), I get an error: arc>((fn () (set my-plus (annotate 'mac (fn (x y) `(+ ,x ,y)))) (my-plus 19 71)))
Error: "Function call on inappropriate object #3(tagged mac #<procedure>) (19 71)"
To my untrained eye, these two are doing the same thing, but Arc evidently has a different opinion. Curiously, though, when I run the ((fn () ... )) expression a second time in the same arc instance, it behaves as expected.I must be completely missing something about namespaces, or the order of evaluation. Can someone give me a hint? thanks |