我想返回兩個集合的工會以下列方式:無法解析符號++斯卡拉
type Set = Int => Boolean
def union(s: Set, t: Set): Set = s ++ t
我得到錯誤「無法解析符號++」。發生了什麼?
我想返回兩個集合的工會以下列方式:無法解析符號++斯卡拉
type Set = Int => Boolean
def union(s: Set, t: Set): Set = s ++ t
我得到錯誤「無法解析符號++」。發生了什麼?
你需要指定的Set
類型參數,如果你正在使用Scala的設置:
def union(s:Set[Int], t:Set[Int]):Set[Int] = s ++ t
可悲的是沒有工作:( – Andrew
你知道你的代碼還有其他一些問題嗎? –
我不知道爲什麼我用++符號得到這個錯誤 – Andrew
什麼是'Set'?它是'scala.collection.Set'? – mfirry