Rotate a list in Haskell
haskell
Solution
For completeness's sake, a version that works with both empty and infinite lists.
rotate :: Int -> [a] -> [a]
rotate _ [] = []
rotate n xs = zipWith const (drop n (cycle xs)) xs
Then
Prelude> rotate 2 [1..5]
[3,4,5,1,2]
Problem
I have a list `a` defined, ``` let a = ["#","@","#","#"] ``` How can I rotate the `@` two spaces, so that it ends up like this? ``` ["#","#","#","@"] ``` I thought this might work, ``` map last init a ``` but maybe the syntax has to be different, because map can only work with one function?