From 56a0964f309244faaec073558092f0834ca71a3d Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 10 Jul 2017 19:21:38 +0200 Subject: [PATCH] better printing --- src/GroupRings.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 30cb020..20703e7 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -197,7 +197,7 @@ zero(RG::GroupRing) = RG() ############################################################################### function show(io::IO, A::GroupRing) - print(io, "Group Ring of [$(A.group)]") + print(io, "Group Ring of $(A.group)") end function show(io::IO, X::GroupRingElem) @@ -208,10 +208,14 @@ function show(io::IO, X::GroupRingElem) elseif isdefined(RG, :basis) non_zeros = ((X.coeffs[i], RG.basis[i]) for i in findn(X.coeffs)) elts = ("$(sign(c)> 0? " + ": " - ")$(abs(c))*$g" for (c,g) in non_zeros) - join(io, elts, "") + str = join(elts, "") + if sign(first(non_zeros)[1]) > 0 + str = str[4:end] + end + print(io, str) else warn("Basis of the parent Group is not defined, showing coeffs") - print(io, X.coeffs) + show(io, MIME("text/plain"), X.coeffs) end end