Several items (:char and :string) say they are comparable, but don't appear to actually be. I wrote custom comparator functions for those two types, when I wanted min and max, but there is a broader problem in that the custom comparators are not available outside the type definition namespaces.
Instead, consider adding a :comparator argument to the make-comparable function, which writes an explicit :comparator function into the record upon creation. This should be a formalcompare equivalent, with all cases spelled out.
This can also be used to change between lexicographic and domination sorting in ordered collections, and could also provide a sort order for :set and :matrix as needed.
Several items (
:char
and:string
) say they are comparable, but don't appear to actually be. I wrote custom comparator functions for those two types, when I wantedmin
andmax
, but there is a broader problem in that the custom comparators are not available outside the type definition namespaces.Instead, consider adding a
:comparator
argument to themake-comparable
function, which writes an explicit:comparator
function into the record upon creation. This should be a formalcompare
equivalent, with all cases spelled out.This can also be used to change between lexicographic and domination sorting in ordered collections, and could also provide a sort order for
:set
and:matrix
as needed.