错误:文字不匹配;List[List[(Char, Int)]] required: List[(Char, Int)] at q<-
a2 reduceLeft ((x,y)=>
for{
q<- x
b<- y
} yield (q::b::Nil)
)
where, a2: List[List[(Char, Int)]].
如果a2是List[List[(Char, Int)]]
, x是List[(Char, Int)]
,那么q是(Char, Int)
, b也是,它是如何找到List[List[(Char, Int)]]
的?
问题是yield
返回List[(Char, Int)]
,因此for循环返回List[List[(Char, Int)]]
。
因此,reduceLeft
抱怨,因为它期望返回类型为List[(Char, Int)]
。