Re: The last shall be last

2004-09-04 Thread Jonathan Lang
John Williams wrote: > Jonathan Lang wrote: > > The only place where it makes > > sense to wrap is when you define 0th as the final element, making it > > logical that 0th+1 == 1st and 1st-1 == 0th. > > I don't think 0th is a good name for the final element. I've never seen > it used for that. I

Re: The last shall be last

2004-09-05 Thread Matt Diephouse
On Sat, 4 Sep 2004 22:17:22 -0700 (PDT), Jonathan Lang > Agreed; that's why I'd include "last" for newbies to use. "0th" as "last" > works only as an extension of "-1st" as "first from last", "-2nd" as > "second from last", and so on; you have positive numbers counting from the > first, and negat

Re: The last shall be last

2004-09-06 Thread John Williams
On Sun, 5 Sep 2004, Matt Diephouse wrote: > Am I the only one that thinks that -1st should return the last element > in an array under the nth scheme? 1st should mean the first element. > -1st should mean the first element of the reversed array. > > Don't say -1st is the "first from last". If last

Re: The last shall be last

2004-09-06 Thread Smylers
John Williams writes: > On Sun, 5 Sep 2004, Matt Diephouse wrote: > > > Don't say -1st is the "first from last". If last is the opposite of > > first, I would expect 1st to mean "first from first," which would > > mean the second. Say "first from the end". > > It matches up with perl5 C<$array[-

Re: The last shall be last

2004-09-07 Thread Jonathan Lang
Smylers wrote: > (But personally I'm quite happy with zero-based arrays, so as long as > -1 continues to work for those I'm not too bothered what happens with > other cases.) This is an interesting point: can the perl optimizer be made to treat 0-based contiguous lists in the same way that perl 5

Re: The last shall be last

2004-09-25 Thread Jonadab the Unsightly One
Richard Proctor <[EMAIL PROTECTED]> writes: >> Conflict with "last LOOP"? Hm, the context should be enough to >> distinguish them, no? (Hey, maybe they can be unified somehow -- >> "last -1" to skip to the penultimate pass through the loop? =P) > > That could be generalised, "next +1" skipping

The last shall be last (was: The first shall be first)

2004-09-04 Thread Jonathan Lang
Larry Wall wrote: > David Green wrote: > : I actually found things I liked in pretty much all the suggested > : alternatives, but none of them reached out and grabbed me by the > : throat the way "nth" did. It just seems more Perlish. > > Yow. Presumably "nth" without an argument would mean the

Re: The last shall be last (was: The first shall be first)

2004-09-04 Thread David Green
On 2004/9/04, [EMAIL PROTECTED] (Jonathan Lang) wrote: (Nice Subject change, I almost missed it!) >Larry Wall wrote: > > Yow. Presumably "nth" without an argument would mean the last. > >If it means the last, why not just use C? Conflict with "last LOOP"? Hm, the context should be enough to d

Re: The last shall be last (was: The first shall be first)

2004-09-04 Thread Jonathan Lang
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 are synonyms - that is, make "..., -4th, -3rd, -2nd, -1st, 0th, 1st, 2nd, 3rd, 4th, ..." be the underlying mechanism

Re: The last shall be last (was: The first shall be first)

2004-09-04 Thread David Green
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jonathan Lang) wrote: >No problem here, especially if C<0th> and C are synonyms - that is, >make "..., -4th, -3rd, -2nd, -1st, 0th, 1st, 2nd, 3rd, 4th, ..." be the >underlying mechanism, and define C and C as synonyms for >C<0th> and C<1st>. Ye

Re: The last shall be last (was: The first shall be first)

2004-09-04 Thread Jonathan Lang
David Green wrote: > Jonathan Lang wrote: > > If C<@foo[last+1]=$bar> is equivalent to C, 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 b

Re: The last shall be last (was: The first shall be first)

2004-09-04 Thread John Williams
On Sat, 4 Sep 2004, Jonathan Lang wrote: > The only place where it makes > sense to wrap is when you define 0th as the final element, making it > logical that 0th+1 == 1st and 1st-1 == 0th. I don't think 0th is a good name for the final element. I've never seen it used for that. I've only seen i

Re: The last shall be last (was: The first shall be first)

2004-09-05 Thread Smylers
John Williams writes: > BTW, there should be no ambiguity between C and C<''>, > because one occurs where an operator is expected, and one occurs where > a term is expected. There may be no ambiguity for the Perl engine, but any use of C<'> for anything other than quoting makes life hard for synt

Re: The last shall be last (was: The first shall be first)

2004-09-05 Thread Richard Proctor
On Sun 05 Sep, David Green wrote: > On 2004/9/04, [EMAIL PROTECTED] (Jonathan Lang) wrote: > (Nice Subject change, I almost missed it!) > > >Larry Wall wrote: > > > Yow. Presumably "nth" without an argument would mean the last. > > > >If it means the last, why not just use C? > > Conflict with