Comparison & Equality
Numbers compare by value; atoms alphabetically; compound terms by arity, then name, then arguments left to right.
f(X) = f(a) binds X identical (no binding) X == X true, X == Y false arithmetic not equal X @< Y, @>, @=<, @>= standard order of terms compare(Order, X, Y) Order = <, =, > variant (equal up to variable renaming) f(A) =@= f(B) true sound disequality constraint (§30)
9.1 Standard order of terms
Numbers compare by value; atoms alphabetically; compound terms by arity, then name, then arguments left to right.
Var < Number < Atom < String < Compound?- msort([b, 1, "s", f(x), a, X, 2.0], L).
L = [X, 1, 2.0, a, b, "s", f(x)].