scala中reduce函数原理解析------------------------------reduceLeft和reduceRight
看完图之后看具体实例scala>vallist=List(1,2,3,4,5)list:List[Int]=List(1,2,3,4,5)scala>list.reduce(_+_)res0:Int=15#这里0初始值,也是后面高阶函数的柯里化scala>list.fold(0)((x,y)=>x+y)res1:Int=15#默认值是100scala>list.fold(100)((x,y)=>x