99-haskell-problems/Problems 11-20/problem_19.hs

6 lines
129 B
Haskell
Raw Normal View History

2024-05-24 18:50:16 -05:00
rotate :: [a] -> Int -> [a]
rotate l n =
if n >= 0
then (\(x, y) -> y ++ x) $ splitAt n l
else rotate l (length l + n)