Scala: currying vs closure

后端 未结 0 781
梦如初夏
梦如初夏 2020-11-29 16:40

I can use closure to define function like this:

def product(x: Int) = (y: Int) => x * y
val productBy3 = product(3)
println(productBy3(6)) // 18

相关标签:
回答
  • 消灭零回复
提交回复
热议问题