[erlang-questions] Question about higher order function
Burkhard Neppert
bneppert@REDACTED
Fri Nov 30 18:55:53 CET 2007
Hello,
I try to use higher order functions but cannot pass functions as
argument unless
I wrap them in an anonymous function.
Can someone tell me if I'm doing something wrong here or if Erlang is
really so
akward and clumsy why it is this way?
Regards
Burkard Neppert
-module(HOF).
-export([first/1]).
fst({A,B}) -> A.
% This does not compile
% first(L) ->
% lists:map(fst, L).
% but this does:
first(L) ->
lists:map(fun (E) -> fst(E) end, L). % but this is terrible
%%%%%
More information about the erlang-questions
mailing list