When one prints a simple array of floats, one gets:
julia> println(ones(3))
[1.0, 1.0, 1.0]
However, if I print an arrays of unitful quantities, I get:
julia> println(ones(3)u"nm")
Quantity{Float64, ๐, Unitful.FreeUnits{(nm,), ๐, nothing}}[1.0 nm, 1.0 nm, 1.0 nm]
Is there a way (shouldnโt it?) print only [1.0 nm, 1.0 nm, 1.0 nm]
without doing type-piracy?
Being clear: I donโt want to change my implementation of the show
methods of my types to adapt specifically to Unitful
types. Unitful
is not a dependency, just a nice thing to have. The thing is that some printouts, like this:
julia> box = Box(ones(3),0.1)
Box{OrthorhombicCell, 3, Float64, Float64, 9}
unit cell matrix: [1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0]
cutoff: 0.1
number of computing cells on each dimension: [12, 12, 12]
computing cell sizes: [0.1, 0.1, 0.1] (lcell: 1)
Total number of cells: 1728
become way too ugly:
julia> box = Box(ones(3)u"nm",0.1u"nm")
Box{OrthorhombicCell, 3, Quantity{Float64, ๐, Unitful.FreeUnits{(nm,), ๐, nothing}}, Quantity{Float64, ๐^2, Unitful.FreeUnits{(nm^2,), ๐^2, nothing}}, 9}
unit cell matrix: Quantity{Float64, ๐, Unitful.FreeUnits{(nm,), ๐, nothing}}[1.0 nm 0.0 nm 0.0 nm; 0.0 nm 1.0 nm 0.0 nm; 0.0 nm 0.0 nm 1.0 nm]
cutoff: 0.1 nm
number of computing cells on each dimension: [12, 12, 12]
computing cell sizes: Quantity{Float64, ๐, Unitful.FreeUnits{(nm,), ๐, nothing}}[0.1 nm, 0.1 nm, 0.1 nm] (lcell: 1)
Total number of cells: 1728
Any suggestion?