This is my Scala function:
def combine(occur: Occurrences): List[List[Word]] = {
if (occur.isEmpty) List(List())
else {
for {
combintaion <- combinations(occur)
words = getWords(combintaion)
if !words.isEmpty
word: Word <- words
rest <- combine(subtract(occur, combintaion))
} yield List(word) :: rest
}
}
I expect it to return List[List[Word]], but compiler says, that for expression returns List[List[Object]]. Why so, and what should I do?
getWordsreturn?yield List(word) :: resttoyield word :: rest