I'm trying to implement drop function in Erlang:
Returning a collection of all but the first n items in a list.
step(N, C) ->
[_ | T] = C,
case (N > 0) and (length(C) > 0) of
true ->
step(N - 1, T);
false ->
C
end.
drop(_, [ ]) ->
[ ];
drop(Number, Collection) ->
step(Number, Collection).
In Erlang terminal:
drop(3, [11, 22, 33, 44, 55, 66, 77]).
"7BM"
Any ideas why I'm getting that output?
Feel free to suggest more idiomatic Erlang approach.