[erlang-questions] Second order function lists:map

Rob Charlton rob.charlton@REDACTED
Tue Mar 10 17:46:19 CET 2009


Hi Franco,

Well you could either swap the function parameters in my first answer 
(paa(L) -> fun(A) ->...) or you could go with Jeroen's solution using 
list comprehensions - which is arguably more elegant.

Calling apply(F,[X]) is equivalent to F(X), but your solution below 
looks fine to me.

Cheers

Rob

Franco Milicchio wrote:
> Rob, what do you think of this solution?
>
> paa(L) ->
>     fun(X) ->
>             lists:map(fun(F)->apply(F, [X]) end, L)
>     end.
>
>
> Thanks for your pointers!
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions


-- 
Rob Charlton
Savage Minds Ltd





More information about the erlang-questions mailing list