[erlang-questions] list comprehension with match
Kostis Sagonas
kostis@REDACTED
Fri Feb 10 17:59:02 CET 2017
On 02/10/2017 05:26 PM, Kostis Sagonas wrote:
>
>
> Most likely you want the following one:
>
> Member_keys = [fun(#member{key = Key}=M) -> Key end || M <- Members].
>
> which _will_ crash, most likely not due to the fact that it is not
> tested ;)
Wrote it too quicky... Of course I meant the following one;
Member_keys = [(fun(#member{key = Key}) -> Key end)(M) || M <- Members].
Kostis
More information about the erlang-questions
mailing list