例子
val v = Vector(1,2,3,4) var s = v.map(n => n * 2) println(s) //输出:Vector(2, 4, 6, 8) val v2 = Vector(1,10,100,1000) var v3 = v2.reduce((sum,n) => sum + n) println(v3) //输出:1111 val vv = Vector(2,20,200,2000) var sum = 0 vv.foreach( n => sum += n) println(sum) //输出:2222