Is it possible to overload show for an array of a specific type?  See 
example below.

In [1]:
type a_type
    b_element :: Int64
    c_element :: Int64
end
d_array = [a_type(1,2),a_type(3,4),a_type(5,6)]

Out[1]:
3-element Array{a_type,1}:
 a_type(1,2)
 a_type(3,4)
 a_type(5,6)

In [2]:
function Base.show(io::IO, a::Array{a_type,1})
    println(io,rpad("b_element",10),rpad("c_element",10))
    for e in a
        println(io,rpad(e.b_element,10),rpad(e.c_element,10))
    end
end

Out[2]:
show (generic function with 105 methods)

In [3]:
show(d_array)
b_element c_element 
1                2         
3                4         
5                6         

In [4]:
d_array

Out[4]:
3-element Array{a_type,1}:
 a_type(1,2)
 a_type(3,4)
 a_type(5,6)




- Chris

Reply via email to