diff options
author | Joshua Rahm <jrahm@Scipio.(none)> | 2014-04-29 03:57:40 -0600 |
---|---|---|
committer | Joshua Rahm <jrahm@Scipio.(none)> | 2014-04-29 03:57:40 -0600 |
commit | a60702dd882768e7f5b7fcadd39253ac8de9114f (patch) | |
tree | 5983516756b571050e669fdbe5f16ea534e1b9d2 /Graphics | |
parent | 6c9d984c054d634d2873fa3a74c41d2436f7fd53 (diff) | |
download | terralloc-a60702dd882768e7f5b7fcadd39253ac8de9114f.tar.gz terralloc-a60702dd882768e7f5b7fcadd39253ac8de9114f.tar.bz2 terralloc-a60702dd882768e7f5b7fcadd39253ac8de9114f.zip |
added cheesey snow
Diffstat (limited to 'Graphics')
-rw-r--r-- | Graphics/Glyph/Util.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Graphics/Glyph/Util.hs b/Graphics/Glyph/Util.hs index 21e219a..2a3e060 100644 --- a/Graphics/Glyph/Util.hs +++ b/Graphics/Glyph/Util.hs @@ -322,3 +322,16 @@ fpart x = x - (fromIntegral (floor x::Int)) ifNaN :: (RealFloat a) => a -> a -> a ifNaN reg def = if' (isNaN reg) def reg + +everyN :: Int -> [a] -> [a] +everyN _ [] = [] +everyN n (x : xs) = x : (everyN n $ drop n xs) + +chunkList :: [a] -> [(a,a)] +chunkList l = zip [x | x <- everyN 1 l] [x | x <- everyN 1 (tail l)] + +chunkList3 :: [a] -> [(a,a,a)] +chunkList3 l = zip3 + [x | x <- everyN 2 l] + [x | x <- everyN 2 (tail l)] + [x | x <- everyN 2 (tail $ tail l)] |