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"]
clojure (let [fruit ["apple" "orange" "grapes" "bananas"]]
(concat (rest fruit) [(first fruit)])
(let [fruit ["apple" "orange" "grapes" "bananas"]]
(concat (rest fruit) [(first fruit)])
Submit a new solution for
clojure
There are 22 other solutions in
additional languages (
cpp,
csharp,
erlang,
fantom ...)