Created
April 15, 2015 23:23
-
-
Save mpickering/2b38e457f24c52d314c3 to your computer and use it in GitHub Desktop.
RepMin for lists
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
module RepListMin where | |
repListMin :: [Int] -> [Int] | |
repListMin xs = res | |
where | |
(m, res) = repListMin' m xs | |
repListMin' :: Int -> [Int] -> (Int, [Int]) | |
repListMin' m [x] = (x, [m]) | |
repListMin' m (x:xs) = (newmin, m:ls) | |
where | |
(cmin, ls) = repListMin' m xs | |
newmin = min cmin x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment