Arc Forumnew | comments | leaders | submitlogin
3 points by akkartik 4162 days ago | link | parent

The issue is with automaton; you're trying to use a macro (mkrule) like a function with map1. Did you turn mkrule into [mkrule _] because you got this error?

  Can't coerce  #(tagged mac #<procedure: mkrule>) fn
Simply using square brackets isn't going to fix that.

---

In general, creating macro helpers for macros is harder to debug. Instead create function helpers to create the right code as a list and invoke it within the top-level macro to turn it into code. Here mkrule should probably be a function.

(This is what people usually mean when they say *don't overuse macros". And then the dictum gradually gets over-generalized into "macros bad" and finally, "lisp? blub blub.")



2 points by brianru 4161 days ago | link

Yep, that's what I did. Thanks for the advice akkartik -- that seems like a simpler pattern to follow.

I'm still finding that line between functions and macros :)

-----