Problems in the specs for 'gdelete' and 'gindex'
Mark H Weaver 02 Jul 2019 04:23 UTC
Hi,
While working on an implementation of SRFI-121, I found two problems in
in the text:
(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) 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.
This seems to imply that it should be an error if 'value-gen' is
exhausted first. If 'index-gen' produces another index after
'value-gen' is exhausted, I think that means one of the following
must be true:
(a) index exceeds the number of elements generated by 'value-gen'.
(b) the index is negative.
(c) the indices are not strictly increasing.
The spec seems to indicate that all three of these are errors.
However, it then goes on to state:
The result generator is exhausted when either generator is
exhausted
This seems to clearly indicate that it's *not* an error for
'value-gen' to be exhausted first, and that the result generator
should return EOF thereafter.
Do you see the contradiction? I'm not sure what to do here.
Mark