[erlang-questions] passing function references, do we have same ability as bifs?

Robert Virding rvirding@REDACTED
Mon May 4 23:19:09 CEST 2009


erlang:apply(M, F, Args).

Robert

2009/5/1 Kevin <q2h46uw02@REDACTED>

>
> I've figured out how to do this simple "meta-programming",
>
> start() ->
>    run(io, format, ["hello", "there"]).
>
>
> run(M, F, Args) ->
>    M:F("~s ~s~n", Args).
>
>
> But do we have the same power as something like spawn(Module, Function,
> Args), where Args is
> passed in as a list, but its "exploded" into parameters when the
> function is called?
>
> Can something like this work?
>
>
> start() ->
>    run(string, equal, ["hello", "hello"]).
>
>
> run(M, F, Args) ->
>    M:F(Args).  %% called as string:equal("hello", "hello")
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090504/e18ce0a0/attachment.htm>


More information about the erlang-questions mailing list