[erlang-questions] clarify: variable as function name
Mon Dec 10 23:51:59 CET 2007
On 10/12/2007, Andreas Hillqvist <andreas.hillqvist@REDACTED> wrote:
> make_fun(Module, Function, Arity) ->
> fun Module:Function/Arity.
You can actually do it today:
make_fun(M, F, 0) -> fun () -> M:F() end;
make_fun(M, F, 1) -> fun (A1) -> M:F(A1) end;
make_fun(M, F, 2) -> fun (A1, A2) -> M:F(A1, A2) end;
Not beautiful but it works. The only limitation is that you can only reach
exported functions. Which is as it should be.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions