Two sum: Difference between revisions

m
(→‎Haskell - Returning all matches: Added a version using more list comprehension sugaring)
Line 329:
main = mapM_ print $ sumTo 21 [0, 2, 11, 19, 90, 10]</lang>
 
Or, resugaring a little – pulling more into the scope of the list comprehension:
<lang Haskell>sumTo :: Int -> [Int] -> [(Int, Int)]
sumTo n ns =
9,659

edits