[erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental)
Tim Fletcher
mail@REDACTED
Mon Jan 16 19:29:18 CET 2012
> Sometimes its clearer in Erlang to use the sequence method of L1, L2, etc
> simply so what is happening is more clear then defining a number of
> anonymous functions or doing:
>
> lists:map(fun(X) -> X +1 end, lists:filter(fun(X) -> X == 2 end, List)
I agree that's not particularly clear. I also find the sequencing
unclear because you manually have to trace the variables through the
functions.
Here are two relatively compact expressions:
map(fun plus_one/1, filter(fun equals_two/1, List))
[plus_one(X) || X <- List, equals_two(X)]
I can understand adding variables for debugging, but I don't see how
adding variables makes either of those clearer.
Tim
More information about the erlang-questions
mailing list