title: Scala Predicates, and Filter functions?
body: <p>I have a very simple example of a set s1 {1, 2} and I want to apply a predicate p > 1 on it. Now I have implemented this function, and it is giving me correct results.</p>
  
  <pre><code>  def filter(s: Set, p: Int =&gt; Boolean): Set = {(i: Int) =&gt; s(i) &amp;&amp; p(i)}
  </code></pre>
  
  <p>Where definition of set is </p>
  
  <pre><code>  type Set = Int =&gt; Boolean
  </code></pre>
  
  <p>But is there a more elegant way of doing it in Scala?</p>