blob: 45c5a07817231527c4b82934c814205002735243 (
plain)
1
2
3
4
5
6
|
rotate :: [a] -> Int -> [a]
rotate xs c
| c < 0 = rotate xs (c + (length xs))
| otherwise = (drop (c `mod` (length xs)) xs ) ++ (take (c `mod` (length xs)) xs)
rotate' xs c = take (length xs) $ drop (length xs + c) $ cycle xs
|