aboutsummaryrefslogtreecommitdiffstats
path: root/utils.hs
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2021-12-11 16:35:10 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2021-12-11 16:56:28 +0200
commit51842c43509f0c5d31d80ecc4ac87c5a36ac3928 (patch)
treed02af11d535976b6eb49166885ceb3b2c713e311 /utils.hs
parenta5b217240c57f89e3d483a940041efda9a8ee97c (diff)
Day 11
Diffstat (limited to 'utils.hs')
-rw-r--r--utils.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils.hs b/utils.hs
index 0ba4bcb..740a58f 100644
--- a/utils.hs
+++ b/utils.hs
@@ -25,4 +25,9 @@ removeAt :: [Int] -> [b] -> [b]
removeAt is xs = mapWithIndex id xs $> filter (\(i', _) -> i' `notElem` is) .> map snd
slice :: Int -> Int -> [a] -> [a]
-slice from to xs = take (to - from + 1) (drop from xs) \ No newline at end of file
+slice from to xs = take (to - from + 1) (drop from xs)
+
+splitEvery _ [] = []
+splitEvery n list = first : splitEvery n rest
+ where
+ (first, rest) = splitAt n list \ No newline at end of file