jshrager
jshrager

Reputation: 309

Getting function arglist in SBCL Lisp

In SBCL when I describe a lambda I get a bunch of detail:

* (setf f (lambda (a b) (* a b)))
#<FUNCTION (LAMBDA (A B)) {535B3C3B}>                                                                                                               
* (describe f)
#<FUNCTION (LAMBDA (A B)) {535B3C3B}>
 [compiled function]
Lambda-list: (A B)
Derived type: (FUNCTION (T T) (VALUES NUMBER &OPTIONAL))
Documentation: T                                                                                                                                                 
Source form: (LAMBDA (A B) (* A B))                                                                                                                            

How can I these objects? In particular, I want to the lambda-list.

Thanks!

Upvotes: 0

Views: 17

Answers (1)

Barmar
Barmar

Reputation: 781848

You can use FUNCTION-LAMBDA-EXPRESSION to get the function's source code. The lambda-list will be the second element of this.

* (second (function-lambda-expression f))
(A B)

Upvotes: 0

Related Questions