Multi-dimensional array access

Multi-dimensional array access with less arguments than dimensions:

julia> A = zeros(3,3,3,3);

julia> A[1,1] = 7.0
7.0

julia> A[1,1]
7.0

julia> A[1,1,1]
7.0

julia> A[1,1,1,1]
7.0

What is the rationale for this meaning (trailing dimensions = 1), rather than say a method error?

Legacy from matlab.

https://github.com/JuliaLang/julia/issues/5396
https://github.com/JuliaLang/julia/issues/14770
https://github.com/JuliaLang/julia/pull/20040
Also https://github.com/JuliaLang/julia/issues/13157

1 Like