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]
DiskEdit
perl
@list = qw(Apple Banana Carrot);
shift @list;
DiskEdit
perl
@list = qw(Apple Banana Carrot);
$offset = 0;
splice(@list, $offset, 1);
ExpandDiskEdit
java 1.5 or later
list.remove(0);
DiskEdit
clojure
(let [fruit ["Apple" "Banana" "Carrot"]
index 0]
(concat
(take index fruit)
(drop (+ index 1) fruit)))
ExpandDiskEdit
fantom
list := ["Apple", "Banana", "Carrot"]
list.removeAt(0)

Submit a new solution for perl, java, clojure, or fantom
There are 25 other solutions in additional languages (cpp, csharp, erlang, fsharp ...)