cq_shijie
2016-07-14 10:52
val a = List(3,5,9) a.reduceLeft((x,y)=>(x+x))? =12 ? a.reduceLeft((x,y)=>(x+y))? =17 OK a.reduceLeft((x,y)=>(x+x+y))? =31 ?
(3, 5) => 3+3 => 6 , (6, 9)=>6+6 => 12
(3, 5) => 3+5 => 8 , (8, 9)=>8+9 => 17
(3, 5) => 3+3+5 => 11 , (11, 9)=>11+11+9 => 31
Scala程序设计—基础篇
37007 学习 · 77 问题
相似问题