自昨天起,我阻止了有關類型不匹配錯誤的信息,但我看不到如何更正它。也許你可以幫助我。Scala中的類型不匹配錯誤
def combine(head : (Char,Int), xs : Occurrences) : List[Occurrences] =
xs.map { case (x,i) => for (occu <- 1 to head._2) yield List((x,i), (head._1, occu)) }
這裏是我的錯誤:
type mismatch;
found : List[scala.collection.immutable.IndexedSeq[List[(Char, Int)]]]
required: List[forcomp.Anagrams.Occurrences]
我怎樣才能解決這個錯誤類型Occurrences
被定義爲type Occurrences = List[(Char, Int)]
?
別擔心,根據你的回答,我終於找到了解決辦法。謝謝 – Dimitri 2013-05-09 14:01:44
很高興聽到它! – coltfred 2013-05-09 16:03:32