[julia-users] Re: How to correctly create custom representation of an array of a custom type?

2015-11-06 Thread Gnimuc Key
that works, thank you! 在 2015年11月6日星期五 UTC+8下午11:23:55,Matt Bauman写道: > > Whenever you define an IO method, you need to make sure that all IO > methods you call within it also use that argument. Change println("x ...") > to println(io, "x …"). > > On Friday, November 6, 2015 at 8:17:56 AM

[julia-users] Re: How to correctly create custom representation of an array of a custom type?

2015-11-06 Thread Gnimuc Key
Another question: Now I know that strange whitespace comes from array's indent: julia> [Foo(1,2), Foo(1,2)] 2-element Array{Foo,1}: x ---> 1 y ---> 2 x ---> 1 y ---> 2 How can I define my own `show(io::IO, x::Array{Foo, 1})`? julia> function show(io::IO, x::Array{Foo, 1})

[julia-users] Re: How to correctly create custom representation of an array of a custom type?

2015-11-06 Thread Matt Bauman
Whenever you define an IO method, you need to make sure that all IO methods you call within it also use that argument. Change println("x ...") to println(io, "x …"). On Friday, November 6, 2015 at 8:17:56 AM UTC-5, Gnimuc Key wrote: > > we can define a good representation of a new type by