I'm writing a macro for function / macro composition (mixed combinations are possible). Inside of the macro I have to treat symbols which represent functions and those that name macros differently. It is because result function must work with any number of arguments (if 'lowest' function in composition can), and I cannot apply apply
to macros. My question: how to determine what a given symbol represents: function or macro?
Macro:
CL-USER 8 > (macro-function 'bar)
NIL
CL-USER 9 > (macro-function 'lambda)
#<Function LAMBDA 41100B7E94>
Function:
CL-USER 15 > (and (fboundp '+)
(not (macro-function '+))
(not (special-operator-p '+)))
T
来源:https://stackoverflow.com/questions/24557669/how-to-know-whether-a-symbol-represents-function-or-macro