Skip to content

Instantly share code, notes, and snippets.

@thsutton
Created July 13, 2013 14:58
Show Gist options
  • Save thsutton/5990996 to your computer and use it in GitHub Desktop.
Save thsutton/5990996 to your computer and use it in GitHub Desktop.
splitInto :: Int -> [a] -> [[a]]
splitInto :: Int -> [a] -> [[a]]
splitInto n l
| n <= 0 = error "splitInto: n < 1"
splitInto n [] = []
splitInto n l = case splitAt n l of
(c, []) -> [c]
(c, r ) -> c:(splitInto n r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment