Jump to content

Multiplication tables: Difference between revisions

(→‎{{header|Haskell}}: map -> fmap)
Line 2,257:
table n = concat <$> xs
where
xs = map (\x -> fmt x : drop 2 pad : (
map (\y -> if y < x then pad else fmt $ x * y)
else (fmt <$> x * yrange))
<$> range)
range
where
fmt e = drop (length s) (pad ++ s)
Line 2,268 ⟶ 2,267:
pad = " "
range = [1..n]
 
main :: IO ()
main = mapM_ putStrLn $ table 12</lang>
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.