Hi Russel --

> e.g. x..y. I wonder though that given 0 is not a legal index, the type

> of the array of zero length could be denoted [0] real, but then that
> may ruin the consistency of the idea of a range and it's use.

0 is a legal index in Chapel.  For example:

    var A: [-3..3] real;

Defines an array whose indices are -3, -2, -1, 0, 1, 2, 3.

Any range in Chapel whose low bound is greater than its high is empty.
Thus, as Mike alludes to, other empty ranges include:

  var A: [2..1] real;
  var B: [100..1] real;
  var C: [n+1..n] real;

Thus, the interpretation of:

   var D: [1..0] real;

as empty is not leaning on anything from Python.  It's simple a case where
the low bound exceeds the high bound.

(Vaguely related:  To count down in Chapel one uses '1..10 by -1', not
'10..1).

-Brad

------------------------------------------------------------------------------
_______________________________________________
Chapel-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-bugs

Reply via email to