diff options
author | Gabriel Dos Reis <gdr@axiomatics.org> | 2016-01-17 22:53:01 -0800 |
---|---|---|
committer | Gabriel Dos Reis <gdr@axiomatics.org> | 2016-01-17 22:53:01 -0800 |
commit | d07fc9735f40e545edda456e15dbab783c500f6a (patch) | |
tree | 4d9fab82a7085b73a4b00d23389935503fdfc90d /src/algebra/poly.spad.pamphlet | |
parent | 5437d438937eb25eb320fef6e4fd6ebc91ca6dc9 (diff) | |
download | open-axiom-d07fc9735f40e545edda456e15dbab783c500f6a.tar.gz |
subtractIfCan$CancellationAbelianMonoid: return the more principled Maybe %
Diffstat (limited to 'src/algebra/poly.spad.pamphlet')
-rw-r--r-- | src/algebra/poly.spad.pamphlet | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/algebra/poly.spad.pamphlet b/src/algebra/poly.spad.pamphlet index aeca4bf1..c9f16e71 100644 --- a/src/algebra/poly.spad.pamphlet +++ b/src/algebra/poly.spad.pamphlet @@ -331,8 +331,8 @@ PolynomialRing(R:Ring,E:OrderedAbelianMonoid): T == C while not null p1 repeat (a:= p1.first.c exquo p2.first.c) a case "failed" => return "failed" - ee:= subtractIfCan(p1.first.k, p2.first.k) - ee case "failed" => return "failed" + ee := subtractIfCan(p1.first.k, p2.first.k) + ee case nothing => return "failed" p1:= fmecg(p1.rest, ee, a, p2.rest) rout:= [[ee,a], :rout] null p1 => reverse(rout)::% -- nreverse? @@ -346,8 +346,8 @@ PolynomialRing(R:Ring,E:OrderedAbelianMonoid): T == C while not null p1 repeat (a:= p1.first.c exquo p2.first.c) a case "failed" => return "failed" - ee:= subtractIfCan(p1.first.k, p2.first.k) - ee case "failed" => return "failed" + ee := subtractIfCan(p1.first.k, p2.first.k) + ee case nothing => return "failed" p1:= fmecg(p1.rest, ee, a, p2.rest) rout:= [[ee,a], :rout] null p1 => reverse(rout)::% -- nreverse? @@ -539,8 +539,8 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with while not null p1 repeat (a:= p1.first.c exquo p2.first.c) a case "failed" => return "failed" - ee:= subtractIfCan(p1.first.k, p2.first.k) - ee case "failed" => return "failed" + ee := subtractIfCan(p1.first.k, p2.first.k) + ee case nothing => return "failed" p1:= fmecg(p1.rest, ee, a, p2.rest) rout:= [[ee,a], :rout] null p1 => reverse(rout)::% -- nreverse? @@ -554,8 +554,8 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with while not null p1 repeat (a:= p1.first.c exquo p2.first.c) a case "failed" => return "failed" - ee:= subtractIfCan(p1.first.k, p2.first.k) - ee case "failed" => return "failed" + ee := subtractIfCan(p1.first.k, p2.first.k) + ee case nothing => return "failed" p1:= fmecg(p1.rest, ee, a, p2.rest) rout:= [[ee,a], :rout] null p1 => reverse(rout)::% -- nreverse? @@ -581,7 +581,7 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with p2:=p2.rest; e1:=max(p1.first.k:Integer-e+1,0):NonNegativeInteger while not null p1 repeat - if (u:=subtractIfCan(p1.first.k,e)) case "failed" then leave + if (u:=subtractIfCan(p1.first.k,e)) case nothing then leave p1:=fmecg(co * p1.rest, u, p1.first.c, p2) e1:= (e1 - 1):NonNegativeInteger e1 = 0 => p1 @@ -628,7 +628,7 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with rout:Rep := [] p2 := p2.rest while not null p1 repeat - (u:=subtractIfCan(p1.first.k, n)) case "failed" => leave + (u:=subtractIfCan(p1.first.k, n)) case nothing => leave rout:=[[u, p1.first.c], :rout] p1:=fmecg(p1.rest, rout.first.k, rout.first.c, p2) [reverse!(rout),p1] @@ -697,7 +697,7 @@ SparseUnivariatePolynomial(R:Ring): UnivariatePolynomialCategory(R) with p2:=p2.rest rout:=empty()$List(Term) while p1 ~= 0 repeat - (u:=subtractIfCan(p1.first.k, n)) case "failed" => leave + (u:=subtractIfCan(p1.first.k, n)) case nothing => leave rout:=[[u, ct * p1.first.c], :rout] p1:=fmecg(p1.rest, rout.first.k, rout.first.c, p2) [reverse!(rout),p1] |