This function requires you to log in. Please enter your login details

View Problem

Remove an element from a list by index

Given the list [Apple, Banana, Carrot], remove the first element to produce the list [Banana, Carrot]
ExpandDiskEdit
erlang
Result = tl(List),
ExpandDiskEdit
erlang
[_|Result] = List,
ExpandDiskEdit
erlang
N = 1, {Left, Right} = lists:split(N - 1, List), Result = Left ++ tl(Right),
ExpandDiskEdit
erlang
Result = drop(1, List),

Submit a new solution for erlang
There are 18 other solutions in additional languages (cpp, fsharp, groovy, java ...)