Another srfi-114 reference implementation issue Shiro Kawai 23 Oct 2014 19:23 UTC

Hi again,

I think there's a discrepancy in reference implementation regarding
make-listwise-comparator and make-list-comparator.

>From the srfi document, make-list-comparator uses given comparator
to compare cars.  OTOH, make-listwise-comparator applies the given
comparator to cars, then cdrs.  The reference implementation defines
make-list-comparator on top of make-listwise-comparator, but it fails
for example:

 ;; intended to compare list of integers
 (define cmp
  (make-list-comparator
   (make-comparator
    integer? #t
    (lambda (a b) (cond [(< a b) -1] [(= a b) 0] [else 1]))
    (comparator-hash-function eqv-comparator))))

 (comparator-compare cmp '(1 2 3) '(1 2 3))
   => Error due to compare (2 3) vs (2 3) with <

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?

--shiro