David Green wrote:
> Anyway, if we can have "last", we should also have "first" (just for 
> people who don't mind all the extra typing).

No problem here, especially if C<0th> and C<last> are synonyms - that is,
make "..., -4th, -3rd, -2nd, -1st, 0th, 1st, 2nd, 3rd, 4th, ..." be the
underlying mechanism, and define C<last> and C<first> as synonyms for
C<0th> and C<1st>.  I'd also leave out C<nth> as unneccessary, although an
ordinalizer function that takes an integer scalar and produces an ordinal
would be useful.  I'm partial to said function being C<postfix:'th> in
order to maintain symmetry with the ordinal notation (and to let
mathematicians talk about the $i'th and $j'th elements of a vector), but
as long as there's _some_ sort of ordinalizer, I'll be happy.  

> Adam D. Lopresto wrote:
> >That last element isn't "-1st", that's (or at least "(-1)st", 
> >depending on precedence) the one before the 0th, which is the one 
> >before the 1st.  If you want to count from the end, why not go all 
> >the way and use "last", "last-1", "last-2", etc.  "last+1" would be 
> >the first element past the current bounds, so "push @foo, $bar" 
> >would be the same as "@foo[last+1]=$bar".

If C<@foo[last+1]=$bar> is equivalent to C<push @foo, $bar>, what happens
if you say C<@foo[last+2]=$bar>?  While I like the notion that subtracting
from first or adding to last takes you beyond the bounds of the list, you
generally can't go more than one beyond either end, and then only to add
to it.  No, I think we'd be better off having it wrap all the time, and
leaving push and unshift as is.  


=====
Jonathan "Dataweaver" Lang


                
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush

Reply via email to