scala
瓦力冫
喜欢看点书,跑跑步,热爱游戏编程
展开
-
scala map reduce 思想
1. mapval v = Vector(1, 2, 3, 4) val v2 = v.map(n => n * 2) scala> val v = Vector(1, 2, 3, 4) v: scala.collection.immutable.Vector[Int] = Vector(1, 2, 3, 4)scala> val v2 = v.map(n => n * 2...原创 2018-06-13 09:47:40 · 1649 阅读 · 0 评论 -
Scala 语法入门
1. for 循环,while 循环 for(i <- 1 to 3; j <- 1 to 3) println(i * j) for(i<-1 to 3;j<-1 to 3 if i != j) print(f"${10*i+j}%3d") 2. 函数//参数后面跟类型 def sum(a : Int, b : Int) : Int = {return a + b} ...原创 2018-06-16 19:03:50 · 294 阅读 · 0 评论