From ac3191ae40b8df0873f2e04f5bc1017322941b5d Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 9 Dec 2020 11:43:55 +0530 Subject: be more <<>> --- lib/Utils.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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 , (&+) , howMany , sublists + , windows ) where import Data.Char (digitToInt) @@ -39,3 +40,6 @@ howMany predicate = length . filter predicate sublists :: [a] -> [[a]] sublists = concatMap inits . tails + +windows :: Int -> [a] -> [[a]] +windows m = foldr (zipWith (:)) (repeat []) . take m . tails -- cgit v1.2.3