Problems in the specs for 'gdelete' and 'gindex'
Mark H Weaver 21 Jul 2019 01:46 UTC
Hi,
While working on an implementation of SRFI-121, I found three problems
in in the text. SRFI-121 has since been withdrawn, but the same issues
are also present in SRFI-158:
(1) The spec for 'gdelete' states:
The = predicate is passed exactly two arguments, of which the
first was generated by gen before the second.
However, in the case of 'gdelete', '=' will never be applied to two
arguments generated by GEN. Instead, '=' will be used to compare
ITEM (an argument to 'gdelete') with each element generated by GEN.
This leaves me unsure of whether to call (= ITEM PRODUCED-ELEMENT)
or (= PRODUCED-ELEMENT ITEM), and yet the text seems to suggest that
the order might be important.
What would you suggest?
(2) In the spec for 'gindex', I believe that this text:
It is an error if the indices are not strictly increasing, or if
any index exceeds the number of elements generated by value-gen.
should be changed to something equivalent to:
It is an error if the indices are not strictly increasing, or if any
index exceeds or equals the number of elements generated by value-gen.
In other words, each index should be in the range 0..N-1, where N is the
number of elements generated by VALUE-GEN. Is that right?
(3) The spec for 'gindex' makes apparently conflicting assertions about
what should happen if 'value-gen' is exhausted before 'index-gen' is
exhausted. First, it states:
It is an error if the indices are not strictly increasing, or if
any index exceeds the number of elements generated by value-gen.
It then goes on to state:
The result generator is exhausted when either generator is
exhausted
I think there's a condradiction here. If 'value-gen' is exhausted
first, that would seem to imply that there was an index that that
exceeds the number of elements generated by value-gen.
If you disagree, can you please give an example where the following
rule is applicable:
It is an error [...] if any index exceeds the number of elements
generated by value-gen.
and where the other error conditions are not applicable?
Regards,
Mark