aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-12-09 06:13:55 +0000
committerAkshay <[email protected]>2020-12-09 06:13:55 +0000
commitac3191ae40b8df0873f2e04f5bc1017322941b5d (patch)
tree88e845ae69db0beb70c6e1b0d9d96b3699a77774 /lib
parent644c38de8b633dc5e03bff5216f68b2bfde4a645 (diff)
be more <<<functional>>>
Diffstat (limited to 'lib')
-rw-r--r--lib/Utils.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Utils.hs b/lib/Utils.hs
index 89b1bd3..1381f16 100644
--- a/lib/Utils.hs
+++ b/lib/Utils.hs
@@ -6,6 +6,7 @@ module Utils ( binaryToInt
6 , (&+) 6 , (&+)
7 , howMany 7 , howMany
8 , sublists 8 , sublists
9 , windows
9 ) where 10 ) where
10 11
11import Data.Char (digitToInt) 12import Data.Char (digitToInt)
@@ -39,3 +40,6 @@ howMany predicate = length . filter predicate
39 40
40sublists :: [a] -> [[a]] 41sublists :: [a] -> [[a]]
41sublists = concatMap inits . tails 42sublists = concatMap inits . tails
43
44windows :: Int -> [a] -> [[a]]
45windows m = foldr (zipWith (:)) (repeat []) . take m . tails