From: Kim, Ju Ho
Subject: usage of primitive functionp
Date: 
Message-ID: <39BF34A9.9B2FB1D6@hitel.net>
This is a multi-part message in MIME format.
--------------049E9DEBD2CE9A78DD6CD0F8
Content-Type: text/plain; charset=EUC-KR
Content-Transfer-Encoding: 7bit

i couldn't find any usage of one of lisp primitives, functionp

the results are either 'nil' or errors.
how i can get a result 't'

undergnd
--------------049E9DEBD2CE9A78DD6CD0F8
Content-Type: text/x-vcard; charset=EUC-KR;
 name="undergnd.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Kim, Ju Ho
Content-Disposition: attachment;
 filename="undergnd.vcf"

begin:vcard 
n:Kim;Ju Ho
x-mozilla-html:TRUE
url:http://www.cs.rit.edu/~jhk0504
org:Rochester Institute of Technology;Computer Science
adr:;;;;;;
version:2.1
·······················@hitel.net
fn:Kim, Ju Ho
end:vcard

--------------049E9DEBD2CE9A78DD6CD0F8--

From: Rainer Joswig
Subject: Re: usage of primitive functionp
Date: 
Message-ID: <joswig-8F054C.10194413092000@news.is-europe.net>
In article <·················@hitel.net>, "Kim, Ju Ho" 
<········@hitel.net> wrote:

> i couldn't find any usage of one of lisp primitives, functionp
> 
> the results are either 'nil' or errors.
> how i can get a result 't'

? (functionp #'functionp)
T

-- 
Rainer Joswig, Hamburg, Germany
Email: ·············@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/
From: Kent M Pitman
Subject: Re: usage of primitive functionp
Date: 
Message-ID: <sfw7l8g3037.fsf@world.std.com>
Rainer Joswig <······@corporate-world.lisp.de> writes:

> In article <·················@hitel.net>, "Kim, Ju Ho" 
> <········@hitel.net> wrote:
> 
> > i couldn't find any usage of one of lisp primitives, functionp
> > 
> > the results are either 'nil' or errors.
> > how i can get a result 't'
> 
> ? (functionp #'functionp)
> T

A more typical "use" might be:

 (when (functionp *end-of-frobbing-hook*)
   (funcall *end-of-frobbing-hook*))

Though often such applications will want to tolerate symbols, as well, 
since FUNCALL will tolerate them.  As such, one might instead write:

 (defun funcallable-p (x)
   (or (functionp x)
       (and (symbolp x) (fboundp x))))

 ...  (when (funcallable-p *end-of-frobbing-hook*)
        (funcall *end-of-frobbing-hook*)) ...
From: Michael J Short
Subject: Re: usage of primitive functionp
Date: 
Message-ID: <39BF970B.319A9626@tothemoon.freeserve.co.uk>
Hi

Functionp is true if its argument is suitable for applying to arguments,
using for example the funcall or apply function.  otherwise functionp is
false.

is that any help?

"Kim, Ju Ho" wrote:

> i couldn't find any usage of one of lisp primitives, functionp
>
> the results are either 'nil' or errors.
> how i can get a result 't'
>
> undergnd
From: Kent M Pitman
Subject: Re: usage of primitive functionp
Date: 
Message-ID: <sfwg0n4thta.fsf@world.std.com>
Michael J Short <·········@tothemoon.freeserve.co.uk> writes:

> Functionp is true if its argument is suitable for applying to arguments,
> using for example the funcall or apply function.  otherwise functionp is
> false.

This isn't actually quite right.  FUNCTIONP tests for things of type
function.  The CLTL1 definition of FUNCTIONP was, effectively, to test
for things that were "applicable", but the ANSI CL definition is to
test for things of a specific representation type.

The difference is seen in this case:

 (functionp 'car) => false

even though

 (funcall 'car '(a b c)) => A
 (apply 'car '((a b c))) => A

It is true that

 (functionp #'car) => true

and that

 (funcall #'car '(a b c)) => A
 (apply #'car '((a b c))) => A

In CLTL1, it was also true that

 (functionp '(lambda (x) x)) => true   ;CLTL1 only - NOT in ANSI CL  
 (funcall '(lambda (x) x) 3) => 3      ;CLTL1 only - NOT in ANSI CL  

This kind of thing was repaired in ANSI CL.  Neither does FUNCTIONP return
true for a quoted list whose car is LAMBDA, nor does FUNCALL work to call
such a thing.  The reason for this has to do with space-efficient 
compilation, but a side-benefit of this is that the following weirdness
of the CLTL1 "semantics" has been repaired:

 (functionp '(lambda is a greek letter)) => true  ;CLTL1 only - NOT in ANSI CL