Re: Last call for comments on SRFI 228: Composing Comparators
Jakob Wuhrer 16 Nov 2022 19:30 UTC
Lassi Kortela <xxxxxx@lassi.io> writes:
> 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.
Isn't the union type precisely the type corresponding to the sets that
is the union of the sets corresponding to the types that are parts of
the union?
> 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))
I'm personally not a fan of these names
> Also,
>
> (define-record-type CD ; heh
heh indeed