Re: Last Element Reference
- Posted by jzeitlin at cloud9.net Sep 21, 2003
- 498 views
On Sat, 20 Sep 2003 21:13:44 -0700, kbochert at copper.net wrote: >On 20 Sep 2003 at 20:35, jzeitlin at cloud9.net wrote: >> On Sat, 20 Sep 2003 17:02:14 -0700, Al Getz <Xaxo at aol.com> wrote: >> >jzeitlin at cloud9.net wrote: >> [deleted for bandwidth] >> Your proposal, of allowing negative subscripts without the $, requires >> significant >> internal programmatic change to the interpreter - >Sorry, no. > s[3..$-1] >and > s[3..length(s)-1] >and > s[3..-2] >are exactly the same thing expressed with different characters. They mean the same thing _to_you_, who are writing programs using the already-written interpreter/compiler. They are NOT, by any stretch of the imagination, the same thing _to_the_interpreter_. They are three different possible token-sets, which have to be processed differently. However, the first two forms share most of their code; in fact, the only thing that would be different in the processing of the first two is the need to take the extra step of effectively substituting "length(s)" for "$". But see my reply to Pete Lomax. -- Jeff Zeitlin jzeitlin at cyburban.com