Use grid when creating block debris
This commit is contained in:
@@ -9,6 +9,7 @@ module ListHelp
|
||||
, errorHead
|
||||
, foldPairs
|
||||
, loopPairs
|
||||
, slideWindow
|
||||
) where
|
||||
import Data.List
|
||||
|
||||
@@ -61,3 +62,6 @@ safeUncons _ = Nothing
|
||||
errorHead :: String -> [a] -> a
|
||||
errorHead _ (x:_) = x
|
||||
errorHead s [] = error s
|
||||
|
||||
slideWindow :: Int -> [a] -> [[a]]
|
||||
slideWindow n = foldr (zipWith (:)) (repeat []) . take n . tails
|
||||
|
||||
Reference in New Issue
Block a user