Haskell Cyclic Rotation
cyclicRotation :: [Int] -> Int -> [Int]
cyclicRotation [] _ = []
cyclicRotation a k  = back ++ front
  where
    n             = length a
    r             = k `mod` n
    (front, back) = splitAt (n - r) a

This rotates the array to the right by K steps and keeps the wrap-around values in the correct order.