Re: Last Element Reference

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

Again Hello Rob, Hello Derek, 
----------
> From: Igor Kachan <kinz at peterlink.ru>
> Subject: Re: Last Element Reference
> 
> Hello Derek, Hello Rob,
> 
> How about  '|' instead of '$'  ?
> 
> >   sequence X
> > 
> >   X = {"ant", "bear", "cat", "dog", "elephant"}
> > 
> >   ? X[|] --> "elephant"
> >   ? X[|][|] --> 't'
> >   ? X[3 .. |] --> {"cat", "dog", "elephant"}
> >   ? X[3 .. |-1] --> {"cat", "dog"}
> >   ? X[|-1..|] --> {"dog", "elephant"}
> >   ? X[|][3..|] --> "ephant"
> >   ? X[|][|-3..|] --> "hant"
> >   ? X[2][|] --> 'r'
> >   ? X[1 .. |-1] --> {"ant", "bear", "cat", "dog"}
> >   ? X[1 .. floor(|/2)] --> {"ant", "bear"}
> >   ? X[floor(|/2)+1 .. |] --> {"cat", "dog", "elephant"}
> 
> '|' is just a sign for border, bound, limit,
> edge, brink and other ends.
> 
> '$' is dollar, nothing more.

Another way may be:

? X[3..-1|] --> {"cat", "dog"}
? X[-1|..|] --> {"dog", "elephant"}
? X[|][-3|..|] --> "hant"

The 'floor' command is extra one here, so:

? X[1../2|] --> {"ant", "bear"}

The  '+'  and  '*'  commands are impossible
with the '|'  constant, so this reverse notation may 
be very clear and handy for this special case, I think.

This '|' sign is similar to 'l' letter -- 
good mnemonic for the 'last' word.

Color syntax may be handy to differ 'l' and '|'.

'$' is not so good, I think now.

Regards,
Igor Kachan
kinz at peterlink.ru

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

Search



Quick Links

User menu

Not signed in.

Misc Menu