Here’s the code from Code. (Egad, I was more thorough than I remembered.)
Include (-
[ codeSignedCompare x y;
if (x > y) return 1;
if (x < y) return -1;
return 0;
];
[ spaceship v1 v2 k cmp cmp_result;
if (k == NUMBER_TY) cmp = codeSignedCompare;
else cmp = KOVComparisonFunction(k);
cmp_result = cmp(v1,v2);
if (cmp_result > 0) return 1;
if (cmp_result < 0) return -1;
return 0;
];
-)
To decide what number is (v1 - a value of kind K) <=> (v2 - a K):
(- spaceship({v1},{v2},{-strong-kind:K}) -)
To decide if (v1 - a value of kind K) == (v2 - a K):
decide on whether or not v1 <=> v2 is 0;
To decide if (v1 - a value of kind K) <>/!= (v2 - a K):
decide on whether or not v1 <=> v2 is not 0;
Edited to add: With another year of Inform, all that becomes just:
To decide if (v1 - an arithmetic value) == (v2 - an arithmetic value): decide on whether or not v1 is v2.
To decide if (v1 - a value of kind K) == (v2 - a K): (- (~~((KOVComparisonFunction({-strong-kind:K}))({v1}, {v2}))) -)