Menu

#8 negative subscripts

open
nobody
None
5
2002-12-16
2002-12-16
jbrown
No

Add support for negative subscripts. They would simply access the opposite
end of a sequence slice.

for example, a sequence s of length 4:

? s[4] --exact same as below
? s[-1] -- -1 is the last element of s.
? s[3]
? s[-2] --second to last

rather than s[1..length(s)-1], we could more easily type
s[1..-2] for this. (of course length(s)-1 would always work, but this
is much better imo.)

Discussion