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

2002-05-07 Thread [EMAIL PROTECTED]
Hi Gabriele, what you say is one of many other useful information found in this mailing-list. Why nobody writes a technical book (HTML?) about these advanced information?! If Rebol has these great features, but nobody will list and explain them, these features will be lost! If I project a new ca

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

2002-05-06 Thread Gabriele Santilli
Hi Jason, On Sunday, May 05, 2002, 9:30:04 PM, you wrote: JC> cool.. So why can't I also use a similar syntax to do >>> remove tail test -2 remove skip tail test -2 JC> Can you elaborate on that a little please. Most scripting languages are rather slow even if they can be compiled. Ja

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

2002-05-05 Thread Jason Cunliffe
> SKIP can be used with negative values, which is how I normally move > backwards by more than one position. Gregg Yay thanks - that's the one :-) ./Jason -- To unsubscribe from this list, please send an email to [EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.

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

2002-05-05 Thread Gregg Irwin
Hi Jason, << So what are nice efficient REBOL idioms for selecting and removing items, and ranges of items, counting from the tail of big complex series? >> Look at view-ref for all the series related functions. Here are some that relate directly to this discussion: AT CLEAR COPY FIND INDEX? IN

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

2002-05-05 Thread Jason Cunliffe
> >>> 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 l

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

2002-05-05 Thread Gregg Irwin
Hi Jason, << 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[-

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

2002-05-05 Thread Jason Cunliffe
Hi Gabriele > >> test: head test > == "abcde" > >> pick tail test -2 > == #"d" cool.. So why can't I also use a similar syntax to do >> remove tail test -2 > Picking a range means copying, so it's better to have that done > explicitly instead of implicitly. Can you elaborate on that a lit

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

2002-05-05 Thread Gabriele Santilli
Hi Jason, On Sunday, May 05, 2002, 6:15:42 PM, you wrote: JC> any ideas? >> test: tail "abcde" == "" >> test/-2 == #"d" also: >> test: head test == "abcde" >> pick tail test -2 == #"d" Picking a range means copying, so it's better to have that done explicitly instead of implicitly. Regar

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

2002-05-05 Thread Jason Cunliffe
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 wor

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

2002-05-05 Thread Gregg Irwin
Hi Patrick, << My actual problem is to remove the last character of a string. Has anyone a better way ? >> Your second example is obviously preferable to the first. You could use CLEAR in place of REMOVE, but in this case I don't think there's a significant difference. --Gregg -- To unsubsc