Re: Last Element Notation

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu