[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

functionp



>From: Aladin Akyurek <akyurek@niscale.LeidenUniv.nl>
>Subject: functionp
>To: info-mcl@cambridge.apple.com
>Date: Thu, 5 Nov 92 16:38:57 MET
>Cc: akyurek@hammer.niscale.LeidenUniv.nl (Aladin Akyurek [NISCALE])
>Mailer: Elm [revision: 70.30]
>
>When you have a function defined, say (defun junk (x) ... ),
>and you try:
>
>(functionp 'junk)
>
>you get NIL.
>
>Is this not a bug? 
>
>-Aladin

It is not. What you should use instead is 
 (functionp #'junk)  or 
 (functionp (symbol-function 'junk)) 

Unlike Scheme (where every symbol has just one value), Common Lisp
has a value-cell and a function-cell for every symbol. Thus you can do
 (defvar junk 5)
 (defun junk (x) x)

and you'll get
? (junk junk)
5

The sharp-quote (#') gets you the function cell, and THAT is what
you want to test.