module Solutions.P16 (dropEvery) where
dropEvery :: [a] -> Int -> [a]
dropEvery :: forall a. [a] -> Int -> [a]
dropEvery [a]
l Int
n = [a] -> Int -> [a]
forall a. [a] -> Int -> [a]
step [a]
l Int
1
where step :: [a] -> Int -> [a]
step [] Int
_ = []
step (a
x:[a]
xs) Int
k
| Int
k Int -> Int -> Int
forall a. Integral a => a -> a -> a
`mod` Int
n Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = [a] -> Int -> [a]
step [a]
xs (Int
kInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
| Bool
otherwise = a
x a -> [a] -> [a]
forall a. a -> [a] -> [a]
: [a] -> Int -> [a]
step [a]
xs (Int
kInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)