Path: utzoo!mnetor!uunet!husc6!bloom-beacon!think!rlk From: rlk@think.COM (Robert Krawitz) Newsgroups: comp.emacs Subject: Re: functionp Message-ID: <15328@think.UUCP> Date: 22 Jan 88 16:42:56 GMT Sender: usenet@think.UUCP Reply-To: rlk@THINK.COM Organization: Thinking Machines Corporation, Cambridge, MA Lines: 36 In article <8098@reed.UUCP> trost@reed.UUCP (Bill Trost) writes: ]In article <39315@ti-csl.CSNET>, ekberg@home (Tom Ekberg) writes: ]> ... How does the following definition appear to your critical eyes? ]> ]> (defun functionp (object) ]> "Returns t if OBJECT is a function." ]> (cond ((subrp object) t) ]> ((commandp object) t) ]> ((listp object) (eq (car object) 'lambda))) ] ;modified to be cleaner lisp and to avoid line-counter problems ] ]Anyhow, what ya'll are most definitely looking is fboundp, which ]returns t if the argument has a function definition. If you want to ]get at that definition, use symbol-function. Be warned that macros (keyboard macros, that is; not lisp macros, which are a list whose car is 'macro) ]are strings attatched to the function definition, so you may want to ]check for that as well. Fboundp checks that a SYMBOL has a function definition. Bill has something else in mind, namely checking that an OBJECT is a function. Actually, a better way to write this is (defun functionp (object) (or (subrp object) (commandp object) (and (listp object) (or (eq (car object) 'lambda) (eq (car object) 'macro))))) harvard >>>>>> | Robert Krawitz bloom-beacon > |think!rlk ihnp4 >>>>>>>> . rlk@a.HASA.disorg