The Prolog standard ISO/IEC 13211-1:1995/Cor.2:2012
features compare/3
:
8.4.2 compare/3 – three-way comparison
8.4.2.1 Description
compare(Order, X, Y) is true iff Order unifies with R which is one of the following atoms: '=' iff X and Y are identical terms (3.87), '<' iff X term_precedes Y (7.2), and '>' iff Y term_precedes X. [...]
Recently, it dawned on me that using the atoms <
, =
, and >
is somewhat weird:
The predicates (<)/2
and (>)/2
express arithmetic comparison.
The predicate (=)/2
on the other hand is syntactic term unification.
IMHO, a much more natural choice would (have) be(en) @<
, ==
and @>
, as these are exactly the predicates whose fulfillment is determined by compare/3
.
So: why were the atoms <
/=
/>
chosen—and not @<
/==
/@>
?
Recently, it dawned on me that using the atoms <, =, and > is somewhat weird:
The compare/3
predicate existed in several Prolog systems prior to find its way into the ISO Prolog Core standard. The choice here (I was the WG17 Core editor at the time) was to preserve backward compatibility.