The types of the arguments determine the return type. In that sense, A[:, 3]
and A[:, 3:3] are completely different constructs, and the second is much more
like A[:, 3:4] than it is like A[:, 3]. This is no different from the rest of
julia---types matter.
The flip side is Matlab's behavior, where an algorithm that happens to return
3:3 instead of 3:4 can suddenly change the behavior of some later operation
like squeeze, and then reorder your dimensions on you. This is something that
julia developers are trying to avoid.
Best,
--Tim
On Tuesday, May 26, 2015 08:58:47 AM Andrea Cimatoribus wrote:
> I have seen a lot of discussions on this issue, in particular in relation
> to the coming 0.4 release. Since I must admit I got completely lost in the
> debate: is there an agreement on this? Since it is such a fundamental
> element, which can break more or less any piece of code (and is also very
> much connected to the switch to array views, as far as I understood), is it
> possibly wiser to wait for 0.4 for a first test drive of Julia?
> Thanks.
>
> Il giorno giovedì 19 giugno 2014 11:18:10 UTC+2, Carlos Baptista ha scritto:
> > If I do this:
> >
> > A = rand(10, 10)
> > x = A[:, 3]
> >
> > then typeof(x) is Array{Float64, 1}. However if I do this:
> >
> > A = rand(10, 10)
> > x = A[:, 3:3]
> >
> > then typeof(x) is Array{Float64, 2}.
> >
> > Is this a bug, or is this behaviour the intention of the developers? In
> > case of the latter: why?