Brad, (Mike,)

> 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.

Ah, like Fortran. :-)

I wonder if perhaps tuples are always indexed from 1 and because I saw
a lot of ranges 1..n I transferred that idea to arrays – erroneously.
Corrected now.

I am assuming that a parameter x: [?] real is indexed 1..x.size even if
the argument passed in was [-3..3] real.

> 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.

For anyone learning a new language who already knows others, learning
is by comparison. Hence the comparison with Python regarding ranges…

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

…whereas Groovy and others treat 10..1 as 1..10 by -1.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to