Determining function argument list in Common Lisp

前端 未结 3 2044
自闭症患者
自闭症患者 2021-01-11 13:39

Is it possible to find out the argument list of a function, given a function object (or a function\'s symbol) in common lisp?

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-11 14:18

    I don't know of a standard way but in SBCL you can use sb-introspect:function-lambda-list.

    (defun test (a &rest rest &key (b 42)) nil)
    (sb-introspect:function-lambda-list #'test)
    => (A &REST REST &KEY (B 42))
    

提交回复
热议问题