I think it's related to some old Matlab convention that Julia inherited, 
where there is an implicit infinity of singleton dimensions:

rand(5,5)[2,2,1,1] # this is valid
rand(5,5)[1,:] # Returns a 1x5 2D array
rand(5,5)[:,1] # returns a 5-element 1D array

It's kinda consistent in its own way, but it'll change in in Julia 0.5. 
There's infinity-discussion about it on github 
<https://github.com/JuliaLang/julia/issues/13157>.

On Tuesday, February 2, 2016 at 7:03:55 PM UTC-5, Davide Lasagna wrote:
>
> Hi, 
>
> Just out of curiosity. What is the fundamental reason why
>
> size(rand(5, 5), 3)
>
> is equal to 1 and does not raise an error?
>
> Davide
>
>
>

Reply via email to