Determining function argument list in Common Lisp

前端 未结 3 2116
自闭症患者
自闭症患者 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:21

    ANSI Common Lisp provides the function FUNCTION-LAMBDA-EXPRESSION, which may return a lambda expression if the implementation supports it and the expression has been recorded. In the lambda expression, the second item is the argument list - as usual.

    Otherwise to return an argument list is not defined in the ANSI Common Lisp standard and is part of the specific Lisp implementation. For example in some 'delivered' Lisp applications this information may not be present.

    Typically most Common Lisp implementations will have an exported function ARGLIST in some internal package.

提交回复
热议问题