@@ -720,7 +720,7 @@ junitFileHeader --> $LINE(import org.junit.runner.RunWith)
720
720
--> $LINE(import org.junit.Test)
721
721
objectHeader --> $LINE(type Q = (Long,String))
722
722
--> $LINE(val allLetters = (32 to 126).map(_.toChar).mkString)
723
- --> $LINE(implicit val qNumeric = new Numeric[Q]{ def compare(x: Q, y: Q) = (x._1 compare y._1) match { case 0 => x._2 compare y._2; case z => z }; def fromInt(i: Int) = i match { case 0 => 0L->""; case 1 => 1L->allLetters; case _ => i.toLong -> i.toString }; def minus(x: Q, y: Q) = (x._1 - y._1) -> (x._2.reverse diff y._2.reverse).reverse; def negate(x: Q) = (-x._1) -> x._2.reverse; def plus(x: Q, y: Q) = (x._1 + y._1) -> (x._2.toSet|y._2.toSet).toList.sorted.mkString; def times(x: Q, y: Q) = (x._1*y._1) -> (x._2.toSet&y._2.toSet).toList.sorted.mkString; def toDouble(x: Q) = x._1.toDouble; def toFloat(x: Q) = x._1.toFloat; def toInt(x: Q) = x._1.toInt; def toLong(x: Q) = x._1 })
723
+ --> $LINE(implicit val qNumeric = new Numeric[Q]{ def compare(x: Q, y: Q) = (x._1 compare y._1) match { case 0 => x._2 compare y._2; case z => z }; def fromInt(i: Int) = i match { case 0 => 0L->""; case 1 => 1L->allLetters; case _ => i.toLong -> i.toString }; def minus(x: Q, y: Q) = (x._1 - y._1) -> (x._2.reverse diff y._2.reverse).reverse; def negate(x: Q) = (-x._1) -> x._2.reverse; def plus(x: Q, y: Q) = (x._1 + y._1) -> (x._2.toSet|y._2.toSet).toList.sorted.mkString; def times(x: Q, y: Q) = (x._1*y._1) -> (x._2.toSet&y._2.toSet).toList.sorted.mkString; def toDouble(x: Q) = x._1.toDouble; def toFloat(x: Q) = x._1.toFloat; def toInt(x: Q) = x._1.toInt; def toLong(x: Q) = x._1; def parseString(str: String) = None })
724
724
--> $LINE(implicit class LsOps(ls: Q) { def <(lz: Q) = qNumeric.compare(ls, lz) < 0; def >(lz: Q) = qNumeric.compare(ls, lz) > 0; def +(lz: Q) = qNumeric.plus(ls, lz); def *(lz: Q) = qNumeric.times(ls, lz); def min(lz: Q) = if (qNumeric.compare(ls, lz) < 0) ls else lz; def max(lz: Q) = if (qNumeric.compare(ls, lz) < 0) lz else ls })
725
725
726
726
@@ -871,7 +871,7 @@ junitFileHeader --> $LINE(import org.junit.runner.RunWith)
871
871
--> $LINE(import org.junit.Test)
872
872
objectHeader --> $LINE(type Q = (String,Long))
873
873
--> $LINE(val allLetters = (32 to 126).map(_.toChar).mkString)
874
- --> $LINE(implicit val qNumeric = new Numeric[Q]{ def compare(x: Q, y: Q) = (x._1 compare y._1) match { case 0 => x._2 compare y._2; case z => z }; def fromInt(i: Int) = i match { case 0 => ""->0L; case 1 => allLetters->1L; case _ => i.toString -> i.toLong }; def minus(x: Q, y: Q) = (x._1.reverse diff y._1.reverse).reverse -> (x._2 - y._2); def negate(x: Q) = x._1.reverse -> (-x._2); def plus(x: Q, y: Q) = (x._1.toSet|y._1.toSet).toList.sorted.mkString -> (x._2 + y._2); def times(x: Q, y: Q) = (x._1.toSet&y._1.toSet).toList.sorted.mkString -> (x._2*y._2); def toDouble(x: Q) = x._2.toDouble; def toFloat(x: Q) = x._2.toFloat; def toInt(x: Q) = x._2.toInt; def toLong(x: Q) = x._2 })
874
+ --> $LINE(implicit val qNumeric = new Numeric[Q]{ def compare(x: Q, y: Q) = (x._1 compare y._1) match { case 0 => x._2 compare y._2; case z => z }; def fromInt(i: Int) = i match { case 0 => ""->0L; case 1 => allLetters->1L; case _ => i.toString -> i.toLong }; def minus(x: Q, y: Q) = (x._1.reverse diff y._1.reverse).reverse -> (x._2 - y._2); def negate(x: Q) = x._1.reverse -> (-x._2); def plus(x: Q, y: Q) = (x._1.toSet|y._1.toSet).toList.sorted.mkString -> (x._2 + y._2); def times(x: Q, y: Q) = (x._1.toSet&y._1.toSet).toList.sorted.mkString -> (x._2*y._2); def toDouble(x: Q) = x._2.toDouble; def toFloat(x: Q) = x._2.toFloat; def toInt(x: Q) = x._2.toInt; def toLong(x: Q) = x._2; def parseString(str: String) = None })
875
875
--> $LINE(implicit class LsOps(ls: Q) { def <(lz: Q) = qNumeric.compare(ls, lz) < 0; def >(lz: Q) = qNumeric.compare(ls, lz) > 0; def +(lz: Q) = qNumeric.plus(ls, lz); def *(lz: Q) = qNumeric.times(ls, lz); def min(lz: Q) = if (qNumeric.compare(ls, lz) < 0) ls else lz; def max(lz: Q) = if (qNumeric.compare(ls, lz) < 0) lz else ls })
876
876
877
877
0 commit comments