[erlang-questions] [ANN] SeqBind, Sequential Binding Parse Transformation for Erlang (Experimental)
Tristan Sloughter
tristan.sloughter@REDACTED
Mon Jan 16 18:47:38 CET 2012
>
> When I write code like that (instead of just inlining all the arguments
> like a good functional programmer), I do that because I want to be able to
> inspect L1 and L2 in the debugger.
Agreed.
But its also a problem of Erlang verbosity as compared to say:
map (1+) $ filter (== 2) [1,2,3,4,2]
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)
or
[X + 1 || X <- lists:filter(fun(X) -> X == 2 end, List)]
Though, my real favorite solution may be for Erlang to be able to do:
modify_list(List) ->
G(H(List)
where
G(List) -> lists:map(fun(X) -> X +1 end, List);
H(List) -> lists:filter(fun(X) -> X == 2 end, List)
end
end
Tristan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120116/c1aeed3a/attachment.htm>
More information about the erlang-questions
mailing list