Multiplication tables: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: A coarse-grained variant)
Line 2,399: Line 2,399:
11: 121 132
11: 121 132
12: 144</pre>
12: 144</pre>

Or, more roughly and directly:
<lang haskell>import Data.List (groupBy)
import Data.Function (on)
import Control.Monad (join)

main :: IO ()
main =
mapM_ print $
fmap (uncurry (*)) <$>
groupBy
(on (==) fst)
(filter (uncurry (>=)) $ join ((<*>) . fmap (,)) [1 .. 12])</lang>
{{Out}}
<pre>[1]
[2,4]
[3,6,9]
[4,8,12,16]
[5,10,15,20,25]
[6,12,18,24,30,36]
[7,14,21,28,35,42,49]
[8,16,24,32,40,48,56,64]
[9,18,27,36,45,54,63,72,81]
[10,20,30,40,50,60,70,80,90,100]
[11,22,33,44,55,66,77,88,99,110,121]
[12,24,36,48,60,72,84,96,108,120,132,144]</pre>


=={{header|HicEst}}==
=={{header|HicEst}}==