title: Efficient way to test a symmetric function on all pairings of a Seq
body: <p>Suppose I have a collection like <code>[ &quot;a&quot;; &quot;b&quot;; &quot;c&quot; ]</code> and I want to test every element against every <em>other</em> element.</p>
  <p>I could generate all pairs like this:</p>
  <pre class="lang-ml prettyprint-override"><code>let combinations xs = 
    Seq.allPairs xs xs 
    |&gt; Seq.filter (fun (x, y) -&gt; x &lt;&gt; y) 
    |&gt; Seq.toList
  
  combinations [ &quot;a&quot;; &quot;b&quot;; &quot;c&quot; ] 
  // [(&quot;a&quot;, &quot;b&quot;); (&quot;a&quot;, &quot;c&quot;); (&quot;b&quot;, &quot;a&quot;); (&quot;b&quot;, &quot;c&quot;); (&quot;c&quot;, &quot;a&quot;); (&quot;c&quot;, &quot;b&quot;)]
  </code></pre>
  <p>But for my test, I always know that <code>f x y = f y x</code> (since <code>f</code> is symmetric), so I want to trim the number of combinations tested:</p>
  <pre class="lang-ml prettyprint-override"><code>let combinations xs = 
    Seq.allPairs xs xs 
    |&gt; Seq.filter (fun (x, y) -&gt; x &lt;&gt; y &amp;&amp; x &lt; y) 
    |&gt; Seq.toList
  
  combinations [ &quot;a&quot;; &quot;b&quot;; &quot;c&quot; ] 
  // [(&quot;a&quot;, &quot;b&quot;); (&quot;a&quot;, &quot;c&quot;); (&quot;b&quot;, &quot;c&quot;)]
  </code></pre>
  <p>But this:</p>
  <ol>
  <li>Doesn't seem like an efficient way to generate the test cases</li>
  <li>Requires that <code>x : comparison</code>, which I don't think should be necessary</li>
  </ol>
  <p>How should I implement this in F#?</p>