[erlang-questions] Efficiency is passing a functin

Michael Truog mjtruog@REDACTED
Sun Sep 23 03:37:58 CEST 2012


On 09/22/2012 05:07 PM, James Rosenblum wrote:
> Kind people,
>
> Is there an appreciable difference in these two ways of passing a function?
>
> F = fun(A,B) -> my_function(A,B) end.
> lists:map(F, Lst)
>
> vs.
>
> -export([my_function/2]).
>
> lists:map(fun my_function/2, Lst)
>
>From http://www.erlang.org/doc/efficiency_guide/functions.html#id67199
"Calls to local or external functions are the fastest kind of calls."
So, the second solution is best.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120922/031b3c1b/attachment.htm>


More information about the erlang-questions mailing list