[2-21] How do I tell if a symbol names a function and not a macro?


FBOUNDP tests whether the symbol is globally bound to an operator
(e.g., a function, macro, or special form). SYMBOL-FUNCTION returns
the contents of a symbol's "function slot" if the symbol names a
function. But if the symbol names a macro or special form, it is
completely unspecified what a call to SYMBOL-FUNCTION will return.
Instead, use code like the following to test whether a symbol names a
function: 

   (defun fbound-to-function-p (symbol)
     (and (fboundp symbol)
          (not (macro-function symbol))
          (not (special-operator-p symbol))))

----------------------------------------------------------------
;;; *EOF*
Go Back Up

Go To Previous