View Problem

Rotate a list

Given a list ["apple", "orange", "grapes", "bananas"], rotate it by removing the first item and placing it on the end to yield ["orange", "grapes", "bananas", "apple"]
DiskEdit
ruby
items = ["apple", "orange", "grapes", "bananas"]
items << first = items.shift

# items is rotated
# first contains the first value in the list
ExpandDiskEdit
csharp 2.0 (LinkedList), 3.0 ("var" keyword)
var lst = new LinkedList<String>(new String[] {"apple", "orange", "grapes", "banana"});
lst.AddLast(lst.First());
lst.DeleteFirst();
ExpandDiskEdit
cpp C++/CLI .NET 2.0
fruit->Add(fruit[0]); fruit->RemoveAt(0);
ExpandDiskEdit
cpp
rotate(fruit.begin(), fruit.begin()+1, fruit.end());
DiskEdit
clojure
(let [fruit ["apple" "orange" "grapes" "bananas"]]
(concat (rest fruit) [(first fruit)])

Submit a new solution for ruby, csharp, cpp, or clojure
There are 18 other solutions in additional languages (erlang, fantom, fsharp, groovy ...)