TermComparator

interface TermComparator<T : Term> : Comparator<T>

A Comparator for a specific sort of Term, following the standard logic-term total order: variables order before numbers, which order before atoms, which order before structures (compared first by arity, then functor, then arguments left-to-right). DefaultComparator implements the full order across any two Terms and backs Term.compareTo; the other nested objects handle one specific sub-type each, and are mostly useful when only same-sort terms are ever compared (e.g. sorting a list of Atoms).

Inheritors

Types

Link copied to clipboard

Compares two Atoms by their Atom.value, independently of the current locale.

Link copied to clipboard

Implements the standard logic-term total order across any two Terms: variables order before numbers, which order before atoms, which order before structures. This is what backs Term.compareTo.

Link copied to clipboard
Link copied to clipboard

Compares two Reals by their Real.value.

Link copied to clipboard

Compares two Structs first by Struct.arity, then by Struct.functor, then argument-wise, left to right.

Link copied to clipboard

Compares two Vars by their Var.completeName, independently of the current locale.

Functions

Link copied to clipboard
abstract fun compare(a: T, b: T): Int