我可以将函数定义为:
def print(n:Int, s:String = "blah") {}
print: (n: Int,s: String)Unit
我可以这样称呼它:
print(5)
print(5, "testing")
如果我咖喱上面:
def print2(n:Int)(s:String = "blah") {}
print2: (n: Int)(s: String)Unit
我不能用 1 个参数调用它:
print2(5)
<console>:7: error: missing arguments for method print2 in object $iw;
follow this method with `_' if you want to treat it as a partially applied function
print2(5)
我必须提供这两个参数。有没有办法解决这个问题?