Arity of funs
Richard Carlsson
richardc@REDACTED
Wed Mar 15 11:19:30 CET 2000
On Wed, 15 Mar 2000, Tony Pedley wrote:
> Hi,
> Well I've searched the OTP book, trawled the erlang questions
> archive(very good by the way, however there should be an all button on
> the Available Subdirectories) and I still can't work out how to do it.
>
> How do you extract the arity of a Fun? e.g How do I do this
>
> F = fun(X,Y,Z) -> end,
>
> X = get_fun_arity(F).
>
> 3
You don't, I'm sure. Sorry.
1: Neither the old representation of funs as tuples, nor the new
representation in R6 contain the arity. (The BIF erlang:fun_info/1 can
give you some information "for debugging purposes only", but not the
arity.)
2. Even if you know the module where the source code resides, and the
fun-table index of a particular fun, there is no way to ask the module
what the arity of that fun is (short of disassembling the compiled code).
Out of curiosity: why do you want to find the arity of an arbitrary fun?
/Richard Carlsson
Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/
More information about the erlang-questions
mailing list