blob: c69d00333b8e7e0c30a85986efc3caf8650ce9a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
--------------------------------------------------------------------------------
module Utils where
--------------------------------------------------------------------------------
import Data.Function ((&))
--------------------------------------------------------------------------------
(|>) :: a -> (a -> b) -> b
(|>) = (&)
-- | Rotate `xs` as a cycle `n` times.
rotate :: Int -> [a] -> [a]
rotate n xs = take size . drop (n `mod` size) . cycle $ xs
where size = length xs
|