Two sum: Difference between revisions
Content added Content deleted
(→AppleScript Functional: Tidied. Added note on indices.) |
m (→Functional) |
||
Line 87: | Line 87: | ||
{{Trans|JavaScript}} |
{{Trans|JavaScript}} |
||
{{Trans|Haskell}} |
{{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. |
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. |