Two sum: Difference between revisions
→{{header|Haskell}}: (and listing multiple solutions when they exist)
m (→{{header|Haskell}}: (Moved a test into the list comprehension)) |
(→{{header|Haskell}}: (and listing multiple solutions when they exist)) |
||
Line 310:
</pre>
Or, using concatMap, sequence (for a cartesian product) and nubBy, and listing multiple solutions when they exist:
<lang haskell>import Data.List (elem, elemIndices, nubBy)
|