Reputation: 35
Error: type mismatch; found : List[List[(Char, Int)]] required: List[(Char, Int)] at q<- x
a2 reduceLeft ((x,y)=>
for{
q<- x
b<- y
} yield (q::b::Nil)
)
where, a2 : List[List[(Char, Int)]].
If a2 is List[List[(Char, Int)]]
, x is List[(Char, Int)]
, so q is (Char, Int)
, and so is b, how it found List[List[(Char, Int)]]
?
Upvotes: 0
Views: 230
Reputation: 53819
The problem is that yield
returns a List[(Char, Int)]
so the for loop returns a List[List[(Char, Int)]]
.
Therefore, the reduceLeft
complains since it expects the return type to be List[(Char, Int)]
.
Upvotes: 1