Created
August 31, 2015 15:19
-
-
Save gallais/1229c105e055692e1503 to your computer and use it in GitHub Desktop.
Padding Numbers using a circular program
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
module PrintNumber where | |
pad :: Char -> [String] -> [String] | |
pad c xs = ys where | |
(ys, n) = foldr cons ([],0) xs | |
cons x (acc, m) = ((replicate (n - m') c ++ x) : acc, max m m') | |
where m' = length x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment