1
が動作していない:ScalaのTuple10暗黙の順序は、私は次のようにTuple9件までメソッドの仕事を比較得ることができます
import scala.math.Ordered.orderingToOrdered
(1,2,"ab",4,5,6.0,7l,"de",1.0) compare (1,2,"ab",4,5,6.0,7l,"de",1.0)
しかしTuple10と、私はコンパイルエラーを取得:
import scala.math.Ordered.orderingToOrdered
(1,2,"ab",4,5,6.0,7l,"de",1.0,2) compare (1,2,"ab",4,5,6.0,7l,"de",1.0,2) // >> compile error: value compare is not a member of (Int, Int, String, Int, Int, Double, Long, String, Double, Int)
は、私は別の方法を試してみましたが、それもできます暗黙のエラー:
implicitly[Ordering[Tuple10[Int, Int, String, Int, Int, Double, Long, String, Double, Double]]].compare((1,2,"ab",4,5,6.0,7l,"de",1.0,4), (1,2,"ab",4,5,6.0,7l,"de",1.0,4))
compiler error:
No implicit Ordering defined for (Int, Int, String, Int, Int, Double, Long, String, Double, Double).
not enough arguments for method implicitly: (implicit e: Ordering[(Int, Int, String, Int, Int, Double, Long, String, Double, Double)])Ordering[(Int, Int, String, Int, Int, Double, Long, String, Double, Double)]. Unspecified value parameter e.
のように見えます。注文はTuple9までしか定義されていません。私が間違っているなら、私を訂正してください。
ありがとうございます。そのような拡張機能を追加するのに最適な場所は何でしょうか。私はスコープ内でそれが利用可能であることを知っていますが、よりグローバル化するためには、それをいくつかのユーティリティオブジェクトに入れて暗黙的にインポートする方が良いでしょうか? – nir