
Separating Data with a Generic Recursive Partition Function in Scala - philk10
https://spin.atomicobject.com/2020/06/29/recursive-partitioning-scala/#.XvoHy3xU8yA.hackernews
======
cybervasi
A good example of a tail recursive function. There is a bug, however:

    
    
      if (partitionFunctions.isEmpty) {
        results
      }
    

When the recursive function runs out of partition matching functions in the
list, it returns the data that has been partitioned successfully thus far. The
rest of the data that has not been matched is lost. I would suggest adding the
remainder of the input to the result map using a default partition key, e.g.
'others'.

