I'm working through the book Thinking in Erlang. In "Figure 10: Example of case" it has the following example:
many(X) ->
case X of
[] ->
none;
[ _One ] ->
one;
[ _One, _Two ] ->
two;
[ _One, _Two , _Three | _Tail ] ->
many
end.
It says :
If you are wondering why line 9 is not a match against [ _One, _Two | _Tail ], review the list matching rules for list tails at the end of the previous section.
But if I actually match against [ _One, _Two | _Tail ] everything still works as expected. Is there an error in the book or am I getting something wrong ?