Multiplication tables: Difference between revisions

m
(→‎{{header|Haskell}}: or, a Prelude - only version)
Line 2,256:
table n = concat <$> xs
where
xs = concatMap (\x -> [[fmt x] ++ [" "drop 2 pad] ++
concatMap (\y -> if y < x then [" "pad]
else [fmt $ x * y])
range])
range
where
fmt e = drop (length s) (" "pad ++ s)
where
s = show e
pad = " "
range = [1..n]
9,659

edits