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

----- Original Message -----
From: "pat665" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 05, 2002 8:00 AM
Subject: [REBOL] How to remove the last item of a serie ?


> Hi, rebollers !
>
>  My actual problem is to remove the last character of a string. Has anyone a
>  better way ?
>
>  ; way 1
>  test: "abcde"
>  reverse test
>  remove test
>  reverse test
>  test
>
>  ; way 2
>  test: "abcde"
>  remove back tail test
>  test
>
>  Patrick


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to