Re: Last Element Notation
- Posted by David Cuny <dcuny at LANSET.COM> Sep 19, 2003
- 485 views
Robert Craig wrote: > Unless someone has a better idea, I think I'll go ahead > with this idea of $ meaning "the index of the last element". > e.g. > s[1..$] > s[1..$-1] > s[$-2] > etc. I agree that this is probably the best notation. There are shorter notations (for example, see Python), but they lack the clarity of the '$' notation. The only real complaint is that it's another step toward the Perlification of the language. The 'end' token would be more clear: s[1..end] s[1..end-1] s[end-2] but I have difficulty convincing myself that this is much better, especially given that 'end' already has a distinct meaning in Euphoria. And the '$' is shorter and easy to see. Besides, If it were *true* Perlification, you'd have selected the '^' token. -- David Cuny