aboutsummaryrefslogtreecommitdiff
path: root/lib/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Utils.hs')
-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