Last call for comments on SRFI 228: Composing Comparators Arthur A. Gleckler (15 Nov 2022 21:03 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 12:17 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 12:34 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Daphne Preston-Kendal (16 Nov 2022 12:53 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 13:18 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Lassi Kortela (16 Nov 2022 18:39 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 18:44 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 19:18 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (16 Nov 2022 17:34 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Daphne Preston-Kendal (18 Nov 2022 19:06 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Daphne Preston-Kendal (23 Nov 2022 10:10 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Daphne Preston-Kendal (26 Nov 2022 10:54 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Marc Nieper-Wißkirchen (26 Nov 2022 11:22 UTC)
Re: Last call for comments on SRFI 228: Composing Comparators Arthur A. Gleckler (23 Nov 2022 19:43 UTC)

Re: Last call for comments on SRFI 228: Composing Comparators Lassi Kortela 16 Nov 2022 18:39 UTC

>>> PPS The longer I think about it, the more I believe that
>>> make-product-comparator is not a good name because there is not really
>>> a product (but some other kind of (categorical) limit).
>> The names are chosen because make-sum-comparator makes a comparator for a sum type, and make-product-comparator a comparator for a product type. They aren’t properties of the comparisons per se.
> Make-product-comparator does not create a comparator for a product
> type; it creates a comparator for an intersection.  Morally, each
> comparator argument to make-product-comparator is already a comparator
> on a product, but not necessarily antisymmetric ("Hausdorff").  Only
> together with the wrapper-comparators, one gets a product.
>
> Example: (make-product-comparator real-comparator real-comparator)
> does not model the type of the cartesian product of the reals with
> themselves.
>
>> We could go with make-sum-type-comparator and make-product-type-comparator, but those would definitely be too long. I’m reluctant to change the names at the last call, and I especially don’t want to change make-sum-comparator because the name matches the one already used by Schemepunk.
> This does not necessarily mean that the name already used was chosen well. :)
>
> But I think that make-sum-comparator (or make-union-comparator) is not
> a bad name.

Union is easier to understand than sum. But for non-mathematicians,
these names are unfortunately overloaded. In math class we learn that a
union is the set of all the stuff in the other sets. But in programming,
the point of a union type is you can pick one choice, not all of them.
The terminology suggests the opposite of the job that the working
programmer wants done.

I was thinking of something like:

(define person-name-comparator
   (compare-all
    (comparator person? person-last-name string-ci-comparator)
    (comparator person? person-first-name string-ci-comparator)))

(define book-comparator
   (compare-all
    (comparator book? book-author person-name-comparator)
    (comparator book? book-title string-ci-comparator)))

(define cd-comparator
   (compare-all
    (comparator cd? cd-artist person-name-comparator)
    (comparator cd? cd-title string-ci-comparator)))

(define item-comparator
   (compare-one book-comparator cd-comparator))

Also,

(define-record-type CD  ; heh