Two sum: Difference between revisions
m
→Functional
(→AppleScript Functional: Tidied. Added note on indices.) |
m (→Functional) |
||
Line 87:
{{Trans|JavaScript}}
{{Trans|Haskell}}
Nesting concatMap or (>>=) (flip concatMap) yields the cartesian product of the list with itself. Skipping products where the y index is lower than the x index (see the use of 'drop' below) ignores the 'lower triangle' of the cartesian grid, excluding mirror-image and duplicate number pairs.
|