list - Scala: type mismatch found in mapping -
error: type mismatch; found : list[list[(char, int)]] required: list[(char, int)] @ q<- x
a2 reduceleft ((x,y)=> for{ q<- x b<- y } yield (q::b::nil) )
where, a2 : list[list[(char, int)]].
if a2 list[list[(char, int)]]
, x list[(char, int)]
, q (char, int)
, , b, how found list[list[(char, int)]]
?
the problem yield
returns list[(char, int)]
loop returns list[list[(char, int)]]
.
therefore, reduceleft
complains since expects return type list[(char, int)]
.
Comments
Post a Comment