title: Writing a generic function that could filter users based on different predicates
body: <p>Say I have a function like this:</p>
  <pre><code>case class User(id: Int, name: String, age: Int, Salary: Double)
  
  def findRichUsers(users: Seq[User]): Seq[User] = 
    users.filter(x =&gt; x.Salary &gt; 100000)
  </code></pre>
  <p>Is it possible that I can modify this so I pass in a predicate that would could support:</p>
  <ol>
  <li>where salary &gt; 100000</li>
  <li>where age between 10 and 20
  etc.</li>
  </ol>
  <p>Basically want to be able to pass in a custom predicate so I can filter.</p>