title: Scala partition into more than two lists
body: <p>I have a list in Scala that I'm trying to partition into multiple lists based on a predicate that involves multiple elements of the list. For example, if I have</p>
  
  <pre><code>a: List[String] = List("a", "ab", "b", "abc", "c")
  </code></pre>
  
  <p>I want to get <code>b: List[List[String]]</code> which is a List of <code>List[String]</code> such that the sum of the lengths of the inner <code>List[String] == 3</code>. i.e <code>List(List("a", "b", "c"), List("abc"), List("ab", "a"), ...)</code></p>
  
  <p>[Edit] Needs to take a reasonable time for lists of length 50 or less.</p>