Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: How to remove the last item of a serie ?

From: jason:cunliffe:verizon at: 5-May-2002 18:31

> >>> test[-2] > 'd' >> > > That syntax doesn't grab me as being very natural. It kind of makes it look > like series! are circular as well, which they aren't. Anyway, in general I'm
Well granted it looks daft with trivial "abcde" as my example. But in Python when you have long strings, nested lists, tuples and and dictionaries [Python's essence], it is very nice to be able to count backwards in the same way one counts forwards. When appending stuff as is common, this make tons of sense. But as Gabriele pointed out, REBOL lets one do the same partially.
>> test: head test
== "abcde"
>> pick tail test -2
== #"d"
> fine with TAIL, SKIP, and BACK. In this particular case, you could write a > remove-tail function which would be even better.
So what are nice efficient REBOL idioms for selecting and removing items, and ranges of items, counting from the tail of big complex series? ./Jason