For Grassmann.jl, I would like to customize the printing similar to the
Complex numbers. Consider:
julia> using Grassmann julia> @basis tangent(ℝ^2,2,2) # 2D Grade, 2nd Order, 2 Variables (⟨++₁₂⟩, v, v₁, v₂, ∂₁, ∂₂, v₁₂, ∂₁v₁, ∂₂v₁, ∂₁v₂, ∂₂v₂, ∂₁₂, ∂₁v₁₂, ∂₂v₁₂, ∂₁₂v₁, ∂₁₂v₂, ∂₁₂v₁₂) julia> ∇ = ∂1v1 + ∂2v2 0v₁₂ + 1∂₁v₁ + 0∂₂v₁ + 0∂₁v₂ + 1∂₂v₂ + 0∂₁₂ julia> Expr(:call,:/,1,∇⋅∇) :(1 / 0.0v₁ + 0.0v₂ + 1∂₁∂₁ + 1∂₂∂₂)
The problem is that when I embed my number in an
Expr there is ambiguity due to missing parenthesis.
julia> z = 1+im 1 + 1im julia> Expr(:call,:/,1,z) :(1 / (1 + 1im))
Complex numbers this is resolved by adding extra
(...) parenthesis around the printed value.
How can I customize the printing so that my numbers are also parenthesized in an
Expr like this?