为什么复杂的理解失败了?

时间:2013-03-06 22:42:24

标签: scala

object Example extends App {
  val result = for {
    a <- Some(22.5)
    b <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
    c <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
    (aa, bb) <- b
    d <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
    e <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
    f <- Some(123123.213)
    g <- Some(123123.232)
    h <- Some(234234.22)
    i = g * h
  } yield 10
}

//scala: type mismatch;
//found   : scala.collection.immutable.Iterable[Int]
//required: Option[?]
//(aa, bb) <- b
//^

0 个答案:

没有答案