I think using curly braces to denote indexing with dropped singleton
dimensions would be nice:

eg
a[1,:,:] works as now, returns an Array with 3 dimensions
a{1,:,:} returns an Array with 2 dimensions

I realize this has syntax conflicts at this point but it seems it could be
made to work.

Bob



On Wed, Sep 3, 2014 at 10:05 AM, ggggg <[email protected]> wrote:

> Would it be possible and/or worthwhile to allow indexing with dropped
> singleton dimensions with a period modified.
>
> eg
> a[1,:,:] works as now, returns an Array with 3 dimensions
> a.[1,:,:] returns an Array with 2 dimensions
>
> It sort of fits into the use of . as a modifier to represent broadcasting.
>
> On Wednesday, September 3, 2014 6:31:31 AM UTC-6, Stefan Karpinski wrote:
>
>> It depends on what you mean. If you mean non-copying slices, then yes. If
>> you mean that all singleton slices are dropped, then that seems less likely.
>>
>>
>> On Wed, Sep 3, 2014 at 7:20 AM, Neal Becker <[email protected]> wrote:
>>
>>> I hope the goal is for slicing to work like numpy.
>>>
>>> Stefan Karpinski wrote:
>>>
>>> > No, this is a pretty contentious issue. A lot of the relevant
>>> discussion is
>>> > in #4774 <https://github.com/JuliaLang/julia/issues/4774>. The one
>>> thing
>>> > everyone agrees on which is going to happen in 0.4 for sure is that
>>> slicing
>>> > will generally create views into the original array rather than
>>> copying the
>>> > data.
>>> >
>>> >
>>> > On Tue, Sep 2, 2014 at 2:24 PM, Christoph Ortner
>>> > <[email protected]
>>>
>>> >> wrote:
>>> >
>>> >>
>>> >>
>>> >> On Tuesday, 2 September 2014 19:12:01 UTC+1, Stefan Karpinski wrote:
>>> >>>
>>> >>> Are slices in Julia any worse than in Matlab? If so, what does
>>> Matlab do
>>> >>> that's better? I agree that our current slicing needs improvements
>>> (they
>>> >>> are planned), but it is largely due to its Matlab heritage.
>>> >>>
>>> >>
>>> >> I did not mean to apply that Julia is worse in this respect. Off the
>>> cuff,
>>> >> I would say slicing is no better or worse than in matlab. And, for the
>>> >> record, slicing multi-dimensional arrays in Matlab has been driving
>>> me mad
>>> >> for some quite some time.
>>> >>
>>> >> I've skimmed the discussions in the "issues" lists on github, and I
>>> very
>>> >> much liked the idea of  distinguishing
>>> >>     a[i:i, :, :]
>>> >> from
>>> >>     a[i, :, :]
>>> >> until I remembered that I want
>>> >>     a[i,:]
>>> >> to be a row-vector.  But I can't have the cake and eat it too.
>>> >>
>>> >> Is there a consensus yet what the final slicing behaviour will be?
>>> >>
>>> >> --Christoph
>>> >>
>>> >>
>>> --
>>> -- Those who don't understand recursion are doomed to repeat it
>>>
>>>
>>

Reply via email to