There is this index function in "Erlang Programming":
index(0, [X|_]) -> X;
index(N, [_|Xs]) when N>0 -> index(N-1, Xs)
Isn't the guard "when N>0" superfluous because of the pattern matching? Calling index(0, List) will never end up in the second clause so N will always be > 0. Or am I totally wrong here?