title: Return the condition in the fitler?
body: <p>I have the following code to filter a <code>Seq</code> and return the error if nothing returned. </p>
  
  <pre><code>let s = nodes
          |&gt; Seq.filter(fun (a, _, _, _) -&gt; if a.ToLower().Contains(key1)) // condition 1
                                            then true
                                            else false // Error message should have Key1
          |&gt; Seq.filter(....) // condition 2
          |&gt; Seq.filter(....) // condition 3
          ..... 
          |&gt; Seq.filter(function // condition N
             | _, Some date, _, _ -&gt; date &gt;= StartPeriod 
             | _ -&gt; false // put StartPeriod in the final message s is not empty before this step
             )
  
  if Seq.isEmpty s
  then sprintf "Failed by condition 1 (%s) or condition 2 (%s) .... or condition N (Date &gt; %s)" 
                 key1, ...., (StartPeriod.ToShortDateSTring())
  else ....
  </code></pre>
  
  <p>The final error message <code>sprintf</code> will contain all the filter conditions. Is it a way to let the code just return the ones (or just the last one) make the <code>s</code> empty? </p>
  
  <hr>
  
  <p>Based on rmunn's answer, I modified it to return all the filters that contributed to empty the list.</p>
  
  <pre><code>let rec filterSeq filterList input msgs =
      match filterList with
      | [] -&gt; input, msgs
      | (label, filter) :: filters -&gt;
          let result = input |&gt; Seq.filter filter
          if result |&gt; Seq.isEmpty then
              printfn "The \"%s\" filter emptied out the input" label
              Seq.empty, (List.append msgs [label])
          else
              filterSeq filters result (List.append msgs [label])
  
  let intFiltersWithLabels = [
      "Odd numbers", fun x -&gt; x % 2 &lt;&gt; 0
      "Not divisible by 3", fun x -&gt; x % 3 &lt;&gt; 0
      "Not divisible by 5", fun x -&gt; x % 5 &lt;&gt; 0
      "Even numbers", fun x -&gt; x % 2 = 0
      "Won't reach here", fun x -&gt; x % 7 &lt;&gt; 0
  ]
  
  { 1..20 } |&gt; filterSeq intFiltersWithLabels &lt;| List.empty
  </code></pre>