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/vector.spad.pamphlet | |
parent | 5437d438937eb25eb320fef6e4fd6ebc91ca6dc9 (diff) | |
download | open-axiom-d07fc9735f40e545edda456e15dbab783c500f6a.tar.gz |
subtractIfCan$CancellationAbelianMonoid: return the more principled Maybe %
Diffstat (limited to 'src/algebra/vector.spad.pamphlet')
-rw-r--r-- | src/algebra/vector.spad.pamphlet | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/algebra/vector.spad.pamphlet b/src/algebra/vector.spad.pamphlet index 7d143b7a..38b14e15 100644 --- a/src/algebra/vector.spad.pamphlet +++ b/src/algebra/vector.spad.pamphlet @@ -340,13 +340,13 @@ DirectProduct(dim:NonNegativeInteger, R:Type): if R has CancellationAbelianMonoid then - subtractIfCan(u:%, v:%):Union(%,"failed") == + subtractIfCan(u:%, v:%) == w := new(dim,0)$Vector(R) for i in 1..dim repeat - (c := subtractIfCan(qelt(rep u, i), qelt(rep v,i))) case "failed" => - return "failed" + (c := subtractIfCan(qelt(rep u, i), qelt(rep v,i))) case nothing => + return nothing qsetelt!(w, i, c::R) - per w + just per w if R has Ring then |