5 lines
129 B
Haskell
5 lines
129 B
Haskell
rotate :: [a] -> Int -> [a]
|
|
rotate l n =
|
|
if n >= 0
|
|
then (\(x, y) -> y ++ x) $ splitAt n l
|
|
else rotate l (length l + n)
|