Is that *really* the intended effect??? Python and Matlab seem much more 
intuitive and return something sensible:

>> x = [1:10];
>> x(1:9) = x(2:10)

x =
     2     3     4     5     6     7     8     9    10    10


>>> import numpy
>>> x = numpy.arange(1,11)
>>> x[0:9] = x[1:10]
>>> x
array([ 2,  3,  4,  5,  6,  7,  8,  9, 10, 10])


On Thursday, May 8, 2014 8:59:58 PM UTC-7, Jeff Bezanson wrote:
>
> Yes, it is well-defined. The right-hand side is returned, which might 
> cause some confusion here. 
>
> On Thu, May 8, 2014 at 10:10 AM, Neal Becker <[email protected]<javascript:>> 
> wrote: 
> > Is the following well-defined in julia? 
> > 
> > julia> x = [1:10] 
> > 10-element Array{Int64,1}: 
> >   1 
> >   2 
> >   3 
> >   4 
> >   5 
> >   6 
> >   7 
> >   8 
> >   9 
> >  10 
> > 
> > julia> x[1:9] = x[2:10] 
> > 9-element Array{Int64,1}: 
> >   2 
> >   3 
> >   4 
> >   5 
> >   6 
> >   7 
> >   8 
> >   9 
> >  10 
> > 
> > In general, are all such aliased assignments well-defined (all, as in 
> for 
> > arbitrary ranges)? 
> > 
>

Reply via email to