[comp.lang.lisp] functionp, fboundp

eliot@phoenix.Princeton.EDU (Eliot Handelman) (11/27/88)

In article <3320@mit-amt> sokolov@media-lab.media.mit.edu (Michael Sokolov) writes:
>>(setq foo (read))
>>(lambda (x) x)

>	I think the question was what type of object is foo bound to?
>I think it is basically just a list. (fboundp 'foo) returns nil.

Since READ doesn't call EVAL it is just returning a cons. If you need
to have the arguments evaled then you have to write (eval (read)).
That would cause an error in the above example, since LAMBDA is not
a function. 

>however, (funcall foo 1) does return 1.  Accordingly, (functionp foo)
>returns t. I discovered that (functionp 'bar) also returns t, in spite
>of the fact that bar was previously unbound: anyone know why?

FUNCTIONP only says whether its argument is suitable to passed to FUNCALL,
which is true of all symbols. If you want to find out if a symbol has a 
global function definition attached to it you have to use FBOUNDP.

There was some discussion a while back -- though I think it may have been
in the KCl list -- as to what the point of FUNCTIONP was. I think it was
generally agreed that it was pretty pointless. I don't recall whether
X3J13 was planning on rethinking it or not -- perhaps someone from there
might fill us in on the latest update.