Juerd: > Larry Wall: >> [Peter Scott]: >>> It seems strange to have a shortcut for 0..$n-1 but no shortcut >>> for 0..$n. >> >> But then you'd usually want 1..$n instead... > > I think this illustrates very well that it's a bit silly to have a > shortcut for just one of the three much-used ranges.
But is it (just) that? ^5 0 .. 4 ^$n 0 .. $n-1 [EMAIL PROTECTED] 0 .. @a.elems-1 (usage deserves a warning) [EMAIL PROTECTED] zip: @a.keys? @a.indices? ?? 0 .. @a.last-1 (no sc ncsry, prbly no need @all) ?? 1 .. $n (no sc ncsry, or use base-0) ?? 0 .. $n+1 (no sc ncsry) > Indexes and numbers (counts) just aren't the same thing, and I think > source code should communicate meaning using the right words. Indices can be sets of sparse ranges. A sparse range is a set of non-sparse ranges. [7..13; 0..5, 9..Inf]. > The word > for "the last index" is .last, that of "the number of elements" is > .elems, or [EMAIL PROTECTED] If you need the last index, plus one, you > shouldn't > use the number of elements, and if you need the number of elements, > minus one, you shouldn't use the last index. Am I the only one who > cares about this distinction? No. -- Grtz, Ruud