Last active
June 15, 2023 05:15
-
-
Save fwgreen/a77a9b059ce8e4771e55a9f42783fb53 to your computer and use it in GitHub Desktop.
Chunk and friends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chunq :: Int -> [a] -> [[a]] | |
chunq _ [] = [] | |
chunq n xs = let (first, remaining) = splitAt n xs in first : chunq n remaining | |
transpoze :: [[a]] -> [[a]] | |
transpoze [] = [] | |
transpoze ([] : xss) = transpoze xss | |
transpoze ((x:xs) : xss) = (x : [h | (h:_) <- xss]) : transpoze (xs : [ t | (_:t) <- xss]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment