Treatment of empty and zero-dimensional arrays complete
Bradley Lucier 05 May 2022 15:52 UTC
The weird-domains branch:
https://github.com/gambiteer/srfi-231/tree/weird-domains
has, I believe, a complete and consistent treatment of empty and
zero-dimensional arrays.
The two principles I tried to follow are:
1. zero-dimensional arrays have a single element and their getters and
setters take zero indices as arguments. The zero-dimensional interval
has no lower or upper bounds.
2. Intervals satisfy l_k <= u_k for all lower and upper bounds and axes
k; if any l_k=u_k, then that interval is empty. Arrays with empty
intervals as domains are themselves called empty, and it is an error to
call the getter or setter of an empty array. Any operation on arrays
that doesn't need to call the getter or setter of that array is legal on
empty arrays, so (array-any empty-array) => #f, (array-every
empty-array) => #t, etc.
I believe everything is implemented and documented, but I need to test
array-tile, array-append, and array-block more thoroughly.
The Git diff (ignoring whitespace differences) between the head and
where I branched the canonical repository shows
heine:~/lang/scheme/srfi-231/srfi-231> git diff -w
5096fc9b4180fa67c7f7da950f14b0dabfa659ec | wc
5374 34095 322629
1100 lines of that is for the weird-domains checklist (in .scm and .html
files), and the documentation changes also show up twice (in
srfi-231.scm and srfi-231.html), so it's not quite as bad as it looks.
Comments welcome.
Brad