例如:
.RunCommand
我希望julia> print([1,"2"])
Any[1, "2"]
成为控制台输出
对于复杂的数据类型,这会变得很难看。
答案 0 :(得分:0)
你可能会使用这个丑陋的解决方法:
import Base.show
import Base.repr
function show(io::IO, a::Array{Any,1})
print("[")
first = true
for i in a
print(first ? "":",", repr(i))
first = false
end
print("]")
end
function repr(a::Array{Any,1})
ret = "["
first = true
for i in a
ret *= (first ? "":",") * repr(i)
first = false
end
ret *= "]"
end
julia> print([1,"2"])
[1,"2"]
julia> print([1,"2","t", [1,"2"]])
[1,"2","t",[1,"2"]]