[Compiler-sig] Question about slice
Finn Bock
bckfnn@worldonline.dk
Sun, 14 Apr 2002 15:23:57 GMT
Hi,
Yet another question, this time about the slice ctors and how they
should be used. I made a little change locally:
- | ExtSlice(expr* dims)
+ | ExtSlice(slice* dims)
and I have used the Slice and ExtSlice like this (only showing the
actual slice):
L[1] -->
Slice[lower=Num[n=1], upper=null]
L[1:2] -->
Slice[lower=Num[n=1], upper=Num[n=2]]
L[1:2, 3] -->
ExtSlice[dims=[
Slice[lower=Num[n=1], upper=Num[n=2]],
Slice[lower=Num[n=3], upper=null]
]]
Is that about right? It seem to work OK.
Except that jython happens to support a step argument to its
slicesyntax.
Jython 2.1+ on java1.4.0-beta3 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> "1234567890"[::2]
'13579'
>>>
How do you feel about adding a step argument to the Slice ctor?
regards,
finn