Created
April 2, 2010 17:43
-
-
Save stesla/353433 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
boards :: [Int] -> Int -> [Int] | |
boards _ 0 = [] | |
boards selection length = | |
case filter (>= length) selection of | |
[] -> split selection length | |
xs -> [minimum xs] | |
split :: [Int] -> Int -> [Int] | |
split selection length = smallBoards ++ bigBoards | |
where max = maximum selection | |
(quot, rem) = quotRem length max | |
smallBoards = boards selection rem | |
bigBoards = replicate quot max |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment