[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specification for a new array slicing function



> Stein Vidar Hagfors Haugan wrote:

> > My suggestion would be something a bit more like the native
> > Fortran 9X syntax (not that I actually *know* exactly how that
> > syntax works!) , e.g.:
> > a(0:5:2,:,5:9) would be translated into
> >   arex(a,[0,5,2],-1,[5,9])


The Fortran standard is [Start]:[End][:Stride]. ":" without 
preceding or following numbers means all elements; any or 
all of Start, End, or :Stride can be left off and would default 
to first element, last element, :1, respectively.

I don't see why a new function, whatever it's called, should 
be needed to handle this. It looks (from the user perspective) 
like a simple extension of the current IDL syntax for array 
sectioning. And, again from at least this user's perspective, 
Sect=a[0:5:2,:,5:9] is preferable to Sect=AS(a,[0,5,2],-1,[5,9]), 
which is nowhere near as easy to remember or obvious-looking.