val xx = List(1, 4, 1) //> xx : List[Int] = List(1, 4, 1)
xx.foldLeft((0,0))((t, v) => (t._1+1, t._1+t._2*2)) //> res1: (Int, Int) = (3,4)
t._1+t._2*2 结果是4这是为什么?
xx.foldLeft((0,0))((t, v) => (t._1+1, t._1+t._2*2)) //> res1: (Int, Int) = (3,4)
t._1+t._2*2 结果是4这是为什么?
2017-12-06