How to split a List of elements into lists with at most N items?
ex: Given a list with 7 elements, create groups of 4, leaving the last group possibly with less elem
I think this is the implementation using splitAt instead of take/drop
def split [X] (n:Int, xs:List[X]) : List[List[X]] = if (xs.size <= n) xs :: Nil else (xs.splitAt(n)._1) :: split(n,xs.splitAt(n)._2)