2020-08-05 22:51:55 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
module Utils where
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
import Data.Function ((&))
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(|>) :: a -> (a -> b) -> b
|
|
|
|
(|>) = (&)
|
2020-08-06 00:20:18 +02:00
|
|
|
|
|
|
|
-- | 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
|