Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created July 12, 2015 07:28
Show Gist options
  • Select an option

  • Save shigemk2/8cd69c0c5e72522b7c9a to your computer and use it in GitHub Desktop.

Select an option

Save shigemk2/8cd69c0c5e72522b7c9a to your computer and use it in GitHub Desktop.
代数計算 diff
diff --git a/AlgebraCalculation.scala b/AlgebraCalculation.scala
index 691cca8..851311d 100644
--- a/AlgebraCalculation.scala
+++ b/AlgebraCalculation.scala
@@ -121,7 +121,7 @@ def expand(xs: Expr): Expr = xs match {
case List(x) => List(expand(x))
case (x::y::xs) => multiply(x,y) :: xs
}
- Mul(f(xs.toList): _*)
+ mul(f(xs.toList))
}
case Add(xs@_*) => {
def f(xs: List[Expr]): List[Expr] = xs match {
@@ -129,7 +129,7 @@ def expand(xs: Expr): Expr = xs match {
case (x::xs) if x != expand(x) => expand(x) :: xs
case (x::xs) if x == expand(x) => x :: f(xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment