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