How to know whether a symbol represents function o

2019-05-21 08:48发布

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?

1条回答
Summer. ? 凉城
2楼-- · 2019-05-21 09:47

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
查看更多
登录 后发表回答