How can I globally change the printing format of the REPL? I would specifically like to change the formatting of floats to a more compact style so that
julia> 10/3
3.3333
instead of
julia> 10/3
3.3333333333333335
I found this issue which was closed without resolution.
Looking at the code I see that
function Base.show(io::IO, x::Union{Float64,Float32})
if get(io, :compact, false)
_show(io, x, PRECISION, 6, true, true)
else
_show(io, x, SHORTEST, 0, true, false)
end
end
refers to :compact but I don’t know how to set this. The REPL formatting section of the manual doesn’t mention it either.
The reason that I am asking about this now is that I am doing demonstrations in class.
For these, I would like to keep the syntax as simple as possible so that students can easily follow.
But, I would also like to keep the numbers short.
The projector in my classroom can’t handle high resolution!
Redefining show entirely seems a bit dramatic. I quoted the default show code above. Wouldn’t it be more appropriate to somehow change what is returned by this line: