1 2 3 4 5 6 | def combinations(occurrences: Occurrences): List[Occurrences] = (Nil :: (for { occurrence <- occurrences rest <- combinations(occurrences.filterNot(_._1 == occurrence._1)) n <- 1 to occurrence._2 } yield (occurrence._1, n) :: rest).map(_.sorted)).distinct |