Re: Last call for comments on SRFI 228: Composing Comparators
Jakob Wuhrer 16 Nov 2022 19:23 UTC
Shiro Kawai <xxxxxx@gmail.com> writes:
> But can you define a reasonable base case E ≡
> (make-product-comparator) such that (make-product-comparator X) ≡
> (make-product-comparator E X) ?
Yes, there are comparators that take the role of "zero" and "one", with
respect to the sum and product comparators, respectively.
If I'm not mistaken, those can be implemented as:
#+begin_src scheme
(define comparator-one
(make-comparator (const #t)
(const #t)
(const #f)
(const 0)))
(define comparator-zero
(make-comparator (const #f)
(const #f)
(const #t)
(const 0)))
#+end_src
I think it may be worthwile to export these as variables.
If I'm not mistaken, the set of all comparators together with sum,
product, zero, and one, has a semiring structure.