相关疑难解决方法(0)

为什么以下Scala函数被称为闭包?

对于以下问题:http://pastie.org/4825115,这是我的代码:http://pastie.org/private/n22zohyshn2ymqrbrb3g

def randList(len: Int, n: Int): List[Int] = len match {
  case 0 => List()
  case len => scala.util.Random.nextInt(n) :: randList(len-1, n)
}
Run Code Online (Sandbox Code Playgroud)

但我不知道为什么randList被称为闭包.

closures scala

3
推荐指数
1
解决办法
7873
查看次数

标签 统计

closures ×1

scala ×1