In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jonathan Lang) wrote: >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>.
Yeah, I like that. >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. I'm sold on 'th. nth might also handy if you have some long hairy expression to wrap it around. (I'm not too worried about the exact syntax; I reckon I'll be happy with whatever we end up with.) >> Adam D. Lopresto wrote: >> >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. I would expect that to work like @foo[$last+2]=$bar does in Perl 5 -- adds an undef value for @foo[$last+1] and $bar after that. I was going to suggest that ordinals wrap around and cardinals "stick out", but that's probably just begging for subtle confusing errors. - David "eh, just use Inf-based arrays, then wrapping and sticking out amount to the same thing" Green