Skip to content

Instantly share code, notes, and snippets.

@gallais
Created August 31, 2015 15:19
Show Gist options
  • Save gallais/1229c105e055692e1503 to your computer and use it in GitHub Desktop.
Save gallais/1229c105e055692e1503 to your computer and use it in GitHub Desktop.
Padding Numbers using a circular program
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