[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: should allow empty arrays



Jussi Piitulainen wrote:

Per Bothner writes:

The lower bound b and the upper bound e of a dimension are exact
integers with |(<= b e)|.

This should be (<= b (- e 1)) if you believe in APL, which has
"always" allowed 0-element arrays. So does Common Lisp. I think we
should too,

We do. The upper bound is excluded from the dimension, same as the
arguments to substring in R5RS.

Sorry - I skimmed too fast.

That representation is unfortuantely not very common and it might be
confusing.  Other languages that allow arbitrary lower bounds generally
use an upper bound that is *inclusive* - think Fortran, Pascal, Ada, Algol.
Languages that use an exclusive upper bound generally hard-wire the
lower bound to 0, so the upper bound is actually the length.

That is why I think (lower-bound, length) might be less confusing,
though I agree compatibility with substring is an argument in favor
of the exclusive-lower-bound convention.

   --Per