Re:Functional isn't always better
by jamwt on Friday October 07, 2011 @12:07PM
(#3084577)
Haskell even has sugar for this via list comprehensions:
[ Parent
| on HN ]
This generates the Cartesian product and filters. (x,y) where both x and y are drawn from the original list. The previous solution only generates pairs (x, y) where y is drawn from elements after x.