But it doesn't seem to quite work:
$ sbcl * (macro-function 'unless) #<FUNCTION (MACRO-FUNCTION UNLESS) {1000ADDAB9}> * (macro-function 'foo) NIL * (let ((unless 34)) (macro-function 'unless)) #<FUNCTION (MACRO-FUNCTION UNLESS) {1000ADDAB9}> * (defmacro macp(x &environment env) (macro-function x env)) MACP * (let ((unless 34)) (macp unless)) #<FUNCTION (MACRO-FUNCTION UNLESS) {1000ADDAB9}> * (let ((unless 34)) (macp foo)) NIL
(macrolet ((unless() nil)) (macp unless)) ; should be truthy (flet ((unless() nil)) (macp unless)) ; should be falsy
-----
I have a macro called call. Given (call f arg), I would like to return:
if f is a local lambda, (call-fn f arg)
if f is a macro, (f arg)
otherwise, (call-fn f arg)
So yes, it probably isn't possible after all..
f.arg -> (call f arg) f@arg -> (f arg)