How can I view the definition of a function in lis

2019-05-05 08:06发布

I use sbcl+emacs+slime.
I writing a function in lisp, I use C-c C-c compile, but i've already deleted it.
I can't find it. I want to know how I define it.

I tried use function-lambda-expression, but I get this:

(function-lambda-expression #'b)
T
B

I hope someone can give me some help.Thanks very much in advance!


Thanks Vsevolod. If function define in repl, i can use (descri #'function-name) get how i define the function, but if i through C-c C-c define it, i just get source file

My attempt

1条回答
Summer. ? 凉城
2楼-- · 2019-05-05 08:25

Depending on your settings for debug and optimization you may be able to get it via describe:

CL-USER> (defun f (a) (print a))
F
CL-USER> (describe #'f)
#<FUNCTION F>
  [compiled function]

Lambda-list: (A)
Derived type: (FUNCTION (T) (VALUES T &OPTIONAL))
Source form:
  (SB-INT:NAMED-LAMBDA F
      (A)
    (BLOCK F (PRINT A)))

You can see the definition here in the Souce form part.

查看更多
登录 后发表回答