chickadee » srfi-162 » make-default-comparator

make-default-comparatorprocedure
  • Comparing objects of disjoint types, all elements of one type compare less or greater than a second type.
  • The empty list is ordered before any pairs.
  • Comparing booleans, #f<#t.
  • Comparing characters must use char=? and char<?, order is Unicode codepoint order.
  • Comparing pairs must work the same as make-pair-comparator.
  • Comparing symbols uses an implementation-dependent total order. (Possibly applying symbol->string and string<?).
  • Comparing bytevectors, comparator should conform to make-vector-comparator (make-comparator exact-integer? = < number-hash) bytevector? bytevector-length bytevector-u8-ref.
  • Comparing complex numbers, real parts are compared first, and if equal, order is determined by comparing imaginary parts.
  • Real numbers are compared with = and <.
  • Comparing strings uses string=? and string<?.
  • Vector comparison should behave same as make-vector-comparator (make-default-comparator) vector? vector-length vector-ref.
  • For comparing types registered with comparator-register-default!, default comparator must work like the registered comparator.
  • Hashing is accomplished with default-hash.