1
def combinations(occurrences: Occurrences): List[Occurrences] = occurrences match {
case List() => List(List())
case occ :: occs =>
for {
**occSub <- (0 to occ._2).map((occ._1, _)).toList**
occsCombination <- combinations(occs)
} yield (occSub :: occsCombination).filter(x => x._2 != 0)
}