[erlang-bugs] error in R12B Efficiency Guide
Thu Jan 24 20:30:31 CET 2008
On 1/24/08, Ulf Wiger (TN/EAB) <> wrote:
> The two declarations are of course not equivalent.
> The alternative should rather be:
> foo([_,_,_|_] = L) ->
It should also be noted that even this clause is not exactly
semantically equivalent, because the "length(L) >= 3" guard also
ensured that L is a proper list:
1> (fun(L) when length(L) >= 3 -> true; (_) -> false end)([1,2,3|4]).
2> (fun([_,_,_|_] = L) -> true; (_) -> false end)([1,2,3|4]).
More information about the erlang-bugs