On Monday, 27 May 2013 at 21:36:12 UTC, bearophile wrote:
"pairwise" is a very useful lazy range similar to cartesianProduct, but it yields only the ordered pairs, so they cover only about half (a triangle) of the square matrix of the possibilities.
This will be part of my combinatorics library, but is more general. pairWise is just a specific case of k-subsets (with k=2). By default, it currently provides the subsets in colexicographic order instead of lexicographic, but I intend to make the ordering a policy before I'm done.
