Re: srfi-114 reference implementation fixes John Cowan 16 Nov 2014 15:47 UTC

Shiro Kawai scripsit:

> (1) When /rounding/ argument is a procedure, it is invoked with
>     a single argument (/ x epsilon), while the srfi-114 document
>     says it should be called with two arguments, x and epsilon.

Fixed.

> (2) It uses inexact-real-hash for the hash function, which delegates
>     to number-hash to hash numbers.  However, the hash function
>     should take the rounding mode into account, to satisfy the
>     constraint that hash values for x and y must be equal when
>     x and y are equal w.r.t. the compare procedure.

Fixed.

> Actually I find the srfi text of make-listwise-comparator is not
> clear; is it actually intended to apply comparator to cars and then
> cdrs, as the reference implementation shows, or is it intended to
> apply comparator on cars, looping over lists' spine, as
> make-list-comparator does?

The latter: the implementation is wrong.  List-comparator,
make-list-comparator, and make-listwise-comparator are all intended to
be compatible.  This is what comes of not having a test suite.

Fixed.

I've written the revised source to
<http://www.ccil.org/~cowan/temp/comparators.tar.gz>; it should migrate
to srfi.schemers.org in due course.

If you have a test suite for comparators, I'd appreciate a pointer or copy.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
We call nothing profound that is not wittily expressed.
        --Northrop Frye (improved)