[erlang-questions] Convert atom and arity into fun
Tue Sep 9 18:26:42 CEST 2008
Thanks, Bjorn. Is there a good reason it is undocumented? I mean, if I use
it, am I in danger of my code breaking in a future release because of that?
On Tue, Sep 9, 2008 at 7:58 AM, Bjorn Gustavsson <>wrote:
> 2008/9/8 Edwin Fine <>
>> I had this exact issue last night, and this is something like what I did
>> because I knew in advance what the arities would be (for better or worse,
>> mf_to_fun1(M, F) ->
>> fun(X) -> M:F(X) end.
>> mf_to_fun2(M, F) ->
>> fun(X,Y) -> M:F(X,Y) end.
>> Ugly but it got the job done. It would be really nice if we could just use
>> fun M:F/A, with all these being variables. Surely it can't be a big step
>> beyond apply(M, F, [Args])?
> There is an undocumented BIF that can be called like this
> erlang:make_fun(Mod, Name, Arity)
> to create a fun.
> Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions