HaloO,

Michele Dondi wrote:
IMHO the former is much more useful and common. Mathematically (say, in combinatorics or however dealing with integers) when I happen to have to do with a set of $n elements chances are to a large extent that it is either 0..$n or 1..$n; 0..$n may lead to confusion since it it actually has $n+1 elements.

Not to mention border cases like 0..0 == (0, 0) or (0,)? How many
elements should $x..$y have in general? In particular when fractional
parts are allowed like in $x = 3.2 and $y = 4.6. Does that yield (3.2, 4.2)
or (3.2, 4.2, 4.6) to reach the end exactly? Or would a non-integer number
force the range to have infinitely many members?

How do ranges relate to list concatenation? (0..4,4..6) looks odd, but then
would better be written (0..6) if no double entry 4 is intended. Perhaps we
can live with the numerically lower end always beeing part of the range, the
larger one never, irrespective of the side of the .. they are written on.
Swapping them just means reversing the list:

  0 .. 5 == ( 0, 1, 2, 3, 4)
 -5 .. 0 == (-5,-4,-3,-2,-1)
  0 ..-5 == (-1,-2,-3,-4,-5)
 -5 .. 5 == (-5,-4,-3,-2,-1, 0, 1, 2, 3, 4)

which is how array indices work as well. This also gives proper modulo
semantics which is 5 in all cases above, and applied two times in the
last line.
--

Reply via email to