help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get nargs for a function


From: Stefan Monnier
Subject: Re: get nargs for a function
Date: Sat, 29 Aug 2015 17:41:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Is there a built in way to return the arg list (actually just the number of
> args) for a function that has been passed to me?

The answer is "yes, but fundamentally no".
The reason it's fundamentally no, is that you'd need to answer questions
such as "how many arguments does cl-member take".

In most cases, the better approach is to do something else, such as:

    (condition-case
        (funcall thefunction arg1 arg2 ...)
      (wrong-number-of-arguments
        ...do-something-else...))


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]