Re: sorted?
Mikael Djurfeldt <[email protected]>
| Newsgroups | gmane.lisp.guile.user |
|---|---|
| Message-ID | <CAA2XvwKgAO2BkeZfN3h8sV2bcAf5nvoDzL3x9HnJnxLvTCbi3A@mail.gmail.com> |
On Mon, Dec 9, 2024 at 8:45 PM Mikael Djurfeldt <[email protected]> wrote: > On Mon, Dec 9, 2024 at 8:23 PM <[email protected]> wrote: > >> (lambda (p1 p2) (< (car p1) (car p2))) >> >> Then you'd need a corresponding equal, because otherwise you >> end up with things which are neither less nor equal nor greater, >> i.e. the ordering isn't total, which is bad for sorting :) >> > > `sort' assumes that the elements belong to a "strict total order", which > means that the connectedness-axiom is true, which means that a = b is > *equivalent to* not (a < b or a > b). So, we don't need equal. > Actually, a "total order" is sufficient for `sort', because equal is not necessary for sorting. I should have said that if we have a "strict total order" (as is almost always the case) is sufficient for the equivalence I have been talking about.