|
|
|
|
|
by saurik
5013 days ago
|
|
That seems to be my "if not," case, which I provided some examples for; if this is different, can you please be more explicit? It seems like your "thing" is my "t" and your "foo" is my "run": the only difference is then that I went out of my way to make it more complex my passing the inner thing through the macro to demonstrate it wouldn't get mangled. (def thing "outer thing")
(defmacro foo [prefix]
`(str ~prefix thing))
(let [thing "inner thing"]
(prn (foo "should say outer thing: ")))
"should say outer thing: outer thing"(edit:) Alternatively, maybe you are focussing on the define-inline "macro-defining macro"; you mentioned it here again as "the above", and you had used it above, but as it wasn't defined it didn't seem important. I tried to go ahead and implement it, although to be honest I feel like I did it wrong (spending more time thinking about it, I believe it is correct, modulo your definition of "inline"); that said, it "worked". (defmacro def-inline [[name & args] code]
`(defmacro ~name ~(apply vector args)
~code))
(def thing "outer thing")
(def-inline [foo prefix]
(str prefix thing))
(let [thing "inner thing"]
(prn (foo "should say outer thing: ")))
"should say outer thing: outer thing" |
|