Taxicab numbers: Difference between revisions

→‎{{header|Haskell}}: Data.Function (on) for simpler groupBy expression
m (→‎{{header|Haskell}}: Pruned out one import.)
(→‎{{header|Haskell}}: Data.Function (on) for simpler groupBy expression)
Line 1,220:
 
<lang haskell>import Data.List (groupBy, sortOn, tails, transpose)
import Data.Function (on)
 
--------------------- TAXICAB NUMBERS --------------------
Line 1,226 ⟶ 1,227:
taxis nCubes =
filter ((> 1) . length) $
groupBy ((. fst) .on (==) . fst) $
sortOn fst
[ (fst x + fst y, (x, y))
9,655

edits