Override printed representation of vectors

Is there a way to override the print representation of a complex vector?

u=[1   2]; println( "u=$u")
u=[1im 2]; println( "u=$u")


u=[1 2]
u=Complex{Int64}[0 + 1im 2 + 0im]

I want to get rid of the type specification; yes, I could write some code,
but is there some simple way to achieve this?

You could call

Base.print_array(stdout, u)

which outputs bare-bones contents (without even the brackets). This is an undocumented internal function, however.

1 Like

Thank you, that works
print("["); Base.print_array(stdout, [1im 2+2im]); println("]")
[ 0 + 1im 2 + 2im]
still a bit hard to read due to the spaces, but no user code required!