Re: empty intervals Bradley Lucier 29 Jul 2015 20:21 UTC

> On Jul 29, 2015, at 12:44 PM, Per Bothner <> wrote:
>  "So the getter of an Array with an empty interval as a domain would be able to return
>  no values at all.  So I don't understand constructions that allow Arrays with empty
>  Intervals as domains to return a single value. Since I don't understand it, I don't allow it."
> "Empty intervals" can refer to two different things.  Consider: (l_0,...,l_d-1) and
> (u_0,...,U_d-1).  The number of elements in the array is:
>   (u_0 - l_u) ... * (u_d-1 - l_d_1).  So if any u_i = l_i then the number of elements is 0.
> This should be allowed.  One may view a vector as a 1-dimensional array (and in fact
> Kawa does that); clearly we allow 0-length vectors.
> The confusing issue of "Arrays with empty Intervals as domains to return a single value"
> refers to something slightly different: when the Interval-dimension (d - or 'rank' in APL-ese)
> is zero.  In that case note that the calculation of number of elements (above) returns 1 when d=0.
> Supporting this case is less useful, but I think for consistent and generality we should do so.

Thank you for the explanation.

Perhaps I should explain some of the other questions that arise in my mind when trying to think about empty intervals.

Is (interval ‘#(1) ‘#(0)) allowed?  It’s also empty (in the sense that no multi-indices satisfy 1<= i<0); is it equal to (interval ‘#(1) ‘#(1))?  Or (interval ‘#(2) ‘#(0))?  Or (interval '#(1 1) ‘#(0 0))?  Or is (interval ‘#(0) ‘#(0)) a subset of (interval ‘#(1) ‘#(2))?  (In set theory, the answer is yes.)

Is an empty set of one-indices "the same” (in whatever sense) as an empty set of two-indices?  (In set theory, yes.  In some other theories, I don’t know.)

I understand that the base case of no multiplicands gives one as an answer, because it’s useful.  (That’s the same reason that $0^0=1$, that it’s a useful convention.)

Perhaps if I understood the use of such things.  We already have scalars, why do we need zero-dimensional arrays?  Or arrays that can’t return any values, because their underlying domains are empty?


PS:  We can allow empty vectors with ease because the dimension is fixed (=1).  And all empty vectors can be equal, which again makes sense (all empty sets are equal).  When we start having empty sets with different dimensions and/or different impossible-to-satisfy bounds, I see more problems—they certainly can’t be “substitutionally equal” (which to my mind is what eqv? is), if asking their dimensions gives different answers.  (Perhaps I’m rambling here.)