An Atom.T
is a unique representative for a set of equal texts
(like a Lisp atomic symbol)
\index{atomic symbol}
\index{symbolic expression!atom}
INTERFACEAtom ; TYPE T <: REFANY; CONST Brand = "Atom-1.0"; PROCEDURE FromText(t: TEXT): T;
Return the unique atoma
such that for any textu
, ifText.Equal(u, t)
, thenFromText(u) = a
.
PROCEDURE ToText(a: T): TEXT;
Return a textt
such thatFromText(t) = a
.
PROCEDURE Equal(a1, a2: T): BOOLEAN;
Return a1 = a2
.
PROCEDURE Hash(a: T): INTEGER;
Return a hash code fora
by taking the image ofToText(a)
under some fixed hash function.
PROCEDURE Compare(a1, a2: T): [-1..1];
Cause a checked runtime error.
END Atom.
Compare
causes a checked runtime error because there is no
default order on atoms.