Multiplication tables: Difference between revisions
m
→{{header|Haskell}}: Adjusted tabulation function
m (→{{header|Haskell}}: (Slight rearrangement)) |
m (→{{header|Haskell}}: Adjusted tabulation function) |
||
Line 2,320:
=={{header|Haskell}}==
<lang haskell>import Data.
import Data.
multTable :: Int -> [[String]]
Line 2,338 ⟶ 2,337:
]
table delim rows =
in intercalate delim <$>
transpose
▲ justifyRight n c s = drop (length s) (replicate n c <> s)
((\col -> justifyRight (maximum (length <$> col)) ' ' <$> col) <$>
transpose rows)
main :: IO ()
main =
{{Out}}
<pre> 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12: 144</pre>
|