diff options
Diffstat (limited to 'lib/Utils.hs')
-rw-r--r-- | lib/Utils.hs | 4 |
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 | ||
11 | import Data.Char (digitToInt) | 12 | import Data.Char (digitToInt) |
@@ -39,3 +40,6 @@ howMany predicate = length . filter predicate | |||
39 | 40 | ||
40 | sublists :: [a] -> [[a]] | 41 | sublists :: [a] -> [[a]] |
41 | sublists = concatMap inits . tails | 42 | sublists = concatMap inits . tails |
43 | |||
44 | windows :: Int -> [a] -> [[a]] | ||
45 | windows m = foldr (zipWith (:)) (repeat []) . take m . tails | ||