0.8.4.13
[sbcl.git] / contrib / sb-introspect / sb-introspect.lisp
1 (defpackage :sb-introspect
2   (:use "CL")
3   (:export "FUNCTION-ARGLIST" "VALID-FUNCTION-NAME-P"))
4
5 (in-package :sb-introspect)
6
7 ;; This is here as a discussion point, not yet a supported interface.  If
8 ;; you would like to use the functions here, or you would like other
9 ;; functions to be here, join the debate on sbcl-devel
10
11 (defun valid-function-name-p (name)
12   "True if NAME denotes a function name that can be passed to MACRO-FUNCTION or FDEFINITION "
13   (and (sb-int:valid-function-name-p name) t))
14
15 (defun function-arglist (function)
16   "Given a function designator FUNCTION, return a description of its lambda list.  Works for macros, simple functions and generic functions"
17   (cond ((valid-function-name-p function) 
18          (function-arglist
19           (or (macro-function function) (fdefinition function))))
20         ((typep function 'generic-function)
21          (sb-pcl::generic-function-pretty-arglist function))
22         (t
23          (sb-impl::%simple-fun-arglist function))))
24