empty intervals Alex Shinn (21 Apr 2022 11:02 UTC)
Re: empty intervals Bradley Lucier (21 Apr 2022 16:30 UTC)
Re: empty intervals Bradley Lucier (21 Apr 2022 16:37 UTC)
Re: empty intervals Per Bothner (21 Apr 2022 19:23 UTC)
Re: empty intervals Bradley Lucier (21 Apr 2022 21:59 UTC)
Re: empty intervals Per Bothner (21 Apr 2022 22:11 UTC)
Re: empty intervals Bradley Lucier (23 Apr 2022 17:56 UTC)
Re: empty intervals Per Bothner (23 Apr 2022 19:44 UTC)
Re: empty intervals Alex Shinn (24 Apr 2022 05:03 UTC)
Re: empty intervals John Cowan (21 Apr 2022 22:56 UTC)
Re: empty intervals Alex Shinn (22 Apr 2022 09:03 UTC)

Re: empty intervals Per Bothner 23 Apr 2022 19:44 UTC

On 4/23/22 10:56, Bradley Lucier wrote:
> The sample implementation of specialized arrays by default does no checking of indices and assumes that every multi-index passed to a getter or setter is valid.

That seems the wrong default.  "It is an error" and R7RS "encourages" implementations
to detect and report such.

> Up till now trying to make an empty interval raised an exception, as it seemed that, in general, making an array with no elements wasn't very useful.  So at least some indices into the array are valid.

I'm not sure what your last sentence refers to,

> Do you expect that accessing or storing something into an array with empty domain will always throw an exception?

Well, "it is an error" to use RnRS terminology.  But note this is conceptually the same
as R7RS's "it is an error" for vector-ref.  SRFI-231 already specifies that
"it is an error ... if (cons i0 i-tail) is not in the domain of A."
So no special rule needed for empty-domain arrays.

No special rule is needed for rank-0 arrays either, except that:
   array-ref A i0 . i-tail
needs to be changed to:
   array-ref A . indexes
since for rank-0 array indexes must be the empty list.
Similarly for array-set!, of course.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/