title: How to split a List by a condition into two lists
body: <p>I'm trying to write in functional way the body for this function:</p>
  
  <pre><code>grouping[T](xs: List[T], rule: T =&gt; Boolean): Tuple2[List[T], List[T]]
  </code></pre>
  
  <p>in order to use it like this:</p>
  
  <pre><code>println(grouping(List(1, 2, 100, 3, 4, 501, 12), (x: Int) =&gt; x &gt;= 100))
  println(grouping(List('A', 'C', 'Z', 'T', 'O', 'P', 'N', 'M', 'Y'), (x: 
  Char) =&gt; x &gt;= 'J'))
  </code></pre>
  
  <p>and get:</p>
  
  <pre><code>(List(100, 501), List(1, 2, 3, 4, 12))
  (List(Z, T, O, P, N, M, Y),List(A, C))
  </code></pre>