Multiplication tables: Difference between revisions
m
→{{header|Haskell}}
(→{{header|Haskell}}: Simpler route to max integer string length) |
|||
Line 2,326:
multTable n =
(\x ->
((\y ->
if y < x
Line 2,333:
[1 .. n])) <$>
[1 .. n]
tableString :: Int -> String
tableString n =
unlines $
where
tbl = multTable n▼
▲ w = length $ (last . last) tbl
justifyRight n c s = drop (length s) (mappend (replicate n c) s)
▲ tbl = multTable n
main :: IO ()
main = putStr $ tableString
{{Out}}
|