[erlang-bugs] error in R12B Efficiency Guide
Matthew Dempsky
matthew@REDACTED
Thu Jan 24 20:30:31 CET 2008
On 1/24/08, Ulf Wiger (TN/EAB) <ulf.wiger@REDACTED> 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]).
false
2> (fun([_,_,_|_] = L) -> true; (_) -> false end)([1,2,3|4]).
true
More information about the erlang-bugs
mailing list