Show for vector type that defines matrix getindex

The basic problem here is that your getindex(v::Vector{MyVec}, i::Int, j::Int) breaks how vectors work. In order to let the same code work with either vectors or single-column matrices, arrays are treated as if they had an infinite number of trailing singleton dimensions:

julia> x = rand(3)
3-element Array{Float64,1}:
 0.5208526911072409 
 0.42943207563780583
 0.6718262282859668 

julia> x[2,1]
0.42943207563780583

julia> x[2,1,1]
0.42943207563780583

julia> [size(x,i) for i = 1:3]
3-element Array{Int64,1}:
 3
 1
 1
1 Like