以下代码有什么问题?我正在尝试使用元组 (String, Int) 作为函数的输入类型find_host
。编译器没有给我任何错误,但是当我运行程序时,我得到了一个。我在这里想念什么?
def find_host ( f : (String, Int) ) = {
case ("localhost", 80 ) => println( "Got localhost")
case _ => println ("something else")
}
val hostport = ("localhost", 80)
find_host(hostport)
missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
Expected type was: ?
def find_host ( f : (String, Int) ) = {
^