Re: Last Element Notation
- Posted by Juergen Luethje <j.lue at gmx.de> Sep 19, 2003
- 506 views
Me wrote: > David wrote: > >> 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. > > How about using this, in order to prevent Perlification: > s[1..fin] > s[1..fin-1] > s[fin-2] > > AFAIR 'fin' often appeared at the end of old movies. > >> Besides, If it were *true* Perlification, you'd have selected the '^' token. >> >> -- David Cuny Or how about this: s[1..last] s[1..last-1] s[last-2] Regards, Juergen -- /"\ ASCII ribbon campain | |\ _,,,---,,_ \ / against HTML in | /,`.-'`' -. ;-;;,_ X e-mail and news, | |,4- ) )-,_..;\ ( `'-' / \ and unneeded MIME | '---''(_/--' `-'\_)