a291c8690a
GitOrigin-RevId: e6e19f3d81a982a62e1bba08f0b4f7fdc21b4ea0
13 lines
480 B
Haskell
13 lines
480 B
Haskell
--------------------------------------------------------------------------------
|
|
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
|