我来自 Java,想结合两个部分函数,如下所示:
def sum(a: Int, b: Int, c: Int) : Int = a + b + c
我想写这样的东西:
val l = List(1, 2, 3)
l.foreach(println _ sum (1, _ : Int, 3) ) // It's supposed to apply
// the partial sum(1, _: Int, 3)
// and println computed value.
但它拒绝编译。有没有办法简洁地修复它?