Szymon | 6 Dec 2004 01:29
Picon
Favicon

Problem with retrieving lambda lists.


Hi.

I have not idea how to implement ARGLIST function in sbcl.

Please help.

(defun arglist (fn) ; from cvs: clocc/clocc/src/port/sys.lisp
  "Return the signature of the function."
  ;;
  ;; .....
  ;;
  #+sbcl
  (let ((f (coerce fn 'function)))
    (typecase f
      (STANDARD-GENERIC-FUNCTION (sb-pcl:generic-function-lambda-list f))
      (FUNCTION (sb-kernel:%simple-fun-arglist f)))))

(defvar *some-stubborn-functions*

  (mapcar #'fdefinition

   '(TYPE-ERROR-EXPECTED-TYPE       TWO-WAY-STREAM-OUTPUT-STREAM
    ECHO-STREAM-OUTPUT-STREAM       SIMPLE-CONDITION-FORMAT-ARGUMENTS
    TWO-WAY-STREAM-INPUT-STREAM     HASH-TABLE-P
    TYPE-ERROR-DATUM                STREAM-ERROR-STREAM
    FILE-ERROR-PATHNAME             PACKAGE-ERROR-PACKAGE
    BROADCAST-STREAM-STREAMS        HASH-TABLE-REHASH-THRESHOLD
    CONCATENATED-STREAM-STREAMS     PATHNAMEP
    UNBOUND-SLOT-INSTANCE           ARITHMETIC-ERROR-OPERANDS
(Continue reading)

Alexey Dejneka | 6 Dec 2004 04:01
X-Face
Picon
Favicon

Re: Problem with retrieving lambda lists.

Hello,

Szymon <r5z-u28s_g1d <at> o2.pl> writes:

> I have not idea how to implement ARGLIST function in sbcl.
>
> Please help.
>
> (defun arglist (fn) ; from cvs: clocc/clocc/src/port/sys.lisp
>   "Return the signature of the function."
>   ;;
>   ;; .....
>   ;;
>   #+sbcl
>   (let ((f (coerce fn 'function)))
>     (typecase f
>       (STANDARD-GENERIC-FUNCTION (sb-pcl:generic-function-lambda-list f))
>       (FUNCTION (sb-kernel:%simple-fun-arglist f)))))

        (FUNCTION (sb-kernel:%simple-fun-arglist
                   (sb-kernel:%closure-fun f)))

Or

(require :sb-introspect)
(defun arglist (fn)
  (sb-introspect:function-arglist fn))

--

-- 
Regards,
(Continue reading)

Daniel Barlow | 9 Dec 2004 03:06

Re: Problem with retrieving lambda lists.

Alexey Dejneka <adejneka <at> comail.ru> writes:

>         (FUNCTION (sb-kernel:%simple-fun-arglist
>                    (sb-kernel:%closure-fun f)))
>
> Or
>
> (require :sb-introspect)
> (defun arglist (fn)
>   (sb-introspect:function-arglist fn))

I should add that the latter is very definitely preferred.

-dan

--

-- 
"please make sure that the person is your friend before you confirm"
Szymon | 6 Dec 2004 14:04
Picon
Favicon

Re: Problem with retrieving lambda lists.

Alexey Dejneka <adejneka <at> comail.ru> writes:

>>       (FUNCTION (sb-kernel:%simple-fun-arglist f)))))
>
>         (FUNCTION (sb-kernel:%simple-fun-arglist
>                    (sb-kernel:%closure-fun f)))
>
> Or
>
> (require :sb-introspect)
> (defun arglist (fn)
>   (sb-introspect:function-arglist fn))

Thank you :)

Regards, Szymon.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

Gmane