Re: Remaining work on SRFI 178 Marc Nieper-Wißkirchen 17 Aug 2020 15:16 UTC

Am Mo., 17. Aug. 2020 um 16:48 Uhr schrieb John Cowan <xxxxxx@ccil.org>:

>> - Why does "bitvector-first-bit" does not return #f in case no values equal BIT? Returning "-1" looks more like a C convention and is less helpful because it cannot as easily be tested in, say, (cond (... => (lambda (index) ...))) expressions.

> It's just as easy to test with negative?, and -1 can be interpreted as "before the beginning", which means, e.g. that finding the bit after the first bit is uniformly a matter of adding 1.

The test with "negative?" cannot be used in conjunction with cond/=>
as in my code snipped above. (Similarly, there is no
"negative?"-protocol conversion in SRFI 189.)

If you want a numerical result, +inf.0 is more logical than -1 because
the infimum over an empty set is +inf.0. The mathematically logical
sound interpretation for no bit found is "after the end". "Before the
beginning" would make sense when one looks for the last bit. I
understand that "+inf.0" is not the nicest Scheme value here but there
is a second-best choice, the length of the bitvector (in case we
really want a numerical result).