次のコードの何が問題になっていますか? 関数への入力のタイプとしてタプル (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) ) = {
^