aboutsummaryrefslogtreecommitdiffstats
path: root/utils.hs
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2021-12-14 08:45:15 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2021-12-15 09:59:09 +0200
commitca42298c307a3009720d6bc93f294ae308168262 (patch)
tree14a79e1132340b198cde39410e24ebbbfad46014 /utils.hs
parent31ca38b2824a8d4e8257e14b1a783016ff37258e (diff)
Day 14
Diffstat (limited to 'utils.hs')
-rw-r--r--utils.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils.hs b/utils.hs
index ee89ea1..9fcc553 100644
--- a/utils.hs
+++ b/utils.hs
@@ -37,3 +37,6 @@ splitToPair f lst =
let x' = takeWhile (not . f) lst
y' = dropWhile (not . f) lst $> drop 1
in (x', y')
+
+count :: (a -> Bool) -> [a] -> Int
+count pred xs = xs $> filter pred .> length \ No newline at end of file