How to apply multiple filters in one statement While trying to grasp the potentials of the collection features in F#, I encountered this one:
let needSpecialDocument country = (not country.IsEea) &amp;&amp; (not country.IsInSchengen) 
// could also be: not (country.IsEea || country.IsInSchengen)
let wantToMoveTo country = country.Name = &quot;CC&quot;

let potentialDestinations =
    countries
    |&gt; Seq.filter needSpecialDocument2
    |&gt; Seq.filter wantToMoveTo

Is there a way to combine the two filters into one? I managed the one below but it feels like there is a more fsharpish way to do so..
|&gt; Seq.filter (fun c -&gt; (needSpecialDocument c) &amp;&amp; (wantToMoveTo c))

Test data:
type Country = {Name : string; IsEea : bool; IsInSchengen : bool}
let uk = {Name = &quot;UK&quot;; IsEea = false; IsInSchengen = false}
let ir = {Name = &quot;IR&quot;; IsEea = true; IsInSchengen = false}
let fr = {Name = &quot;FR&quot;; IsEea = true; IsInSchengen = true}
let ch = {Name = &quot;CH&quot;; IsEea = false; IsInSchengen = true}
let cc = {Name = &quot;CC&quot;; IsEea = false; IsInSchengen = false}
let countries = [uk;ir;fr;ch;cc]
Nope, that's pretty much the way.
If you really, really want to make this shorter and less cluttered, and if you face similar situations multiple times in your codebase, you could make yourself a special operator for combining predicates:
let (.&amp;&amp;.) f g c = f c &amp;&amp; g c

Then you can use this operator in your filter:
|&gt; Seq.filter (needSpecialDocument .&amp;&amp;. wantToMoveTo)

But base on my own experience I wouldn't advise this. You make the program slicker and cooler looking, but you're losing some readability. Now whoever reads your program will have to look up the meaning of .&amp;&amp;.. Programs are read more often than they are written.