Skip to content

Instantly share code, notes, and snippets.

@akira093
Created November 26, 2013 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akira093/7656937 to your computer and use it in GitHub Desktop.
Save akira093/7656937 to your computer and use it in GitHub Desktop.
--はーいふたり組作ってー
groupOf :: Int -> [a] -> [[a]]
groupOf 0 _ = undefined
groupOf n [] = []
groupOf n xs = take n xs : groupOf n (drop n xs)
main = print $ groupOf 2 [1..11]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment