[REBOL] Re: How to remove the last item of a serie ?
From: jason:cunliffe:verizon at: 5-May-2002 12:15
Python has a really nice tail syntax for ends of list, strings, tuples etc.
There must be an easy way to do this as cleanly in REBOL...
What do you all think about this essential idioms?
[Python]
>>> test = "abcde"
'abcde'
>>> test[0]
'a'
>>> test[4]
'e'
>>> test[-1]
'e'
>>> test[-2]
'd'
It works with ranges too
[Python]
>>> test[1:3]
'bc'
>>> test[0:-2]
'abc'
REBOL
>> test: "abcde"
== "abcde"
>> test/5
== #"e"
>> test/-2
== none
any ideas?
./Jason
Note: Python uses zero indexing instead of REBOL's more natural common counting
sense "1", also ":" is a 'range' separator