The Atom structure

The Atom structure provides hashed strings that have fast equality testing. The Util Library provides predefined finite maps and sets of atoms, as well as hash tables keyed by atoms.

Synopsis

signature ATOM
structure Atom : ATOM

Interface

type atom

val atom : string -> atom
val atom' : substring -> atom

val toString : atom -> string

val same : (atom * atom) -> bool
val sameAtom : (atom * atom) -> bool

val compare : (atom * atom) -> order
val lexCompare : (atom * atom) -> order

val hash : atom -> word

Description

type atom

The abstract type of hashed strings that support fast equality testing.

val atom : string -> atom

atom s returns the unique hashed representation of the string s as an atom.

val atom' : substring -> atom

atom ss returns the unique hashed representation of the substring ss as an atom.

val toString : atom -> string

toString atm returns the string representation of the atom atm.

val same : (atom * atom) -> bool

same (atm1, atm2) returns true if the two atoms are the same (i.e., their string representations are equal).

val compare : (atom * atom) -> order

compare (atm1, atm2) returns the relation of the two atoms in some unspecified total order. Use lexCompare to compare atoms lexicographically.

val lexCompare : (atom * atom) -> order

compare (atm1, atm2) returns the relation of the two atoms in lexical order.

val hash : atom -> word

hash atm returns a hash key for the atom.

Deprecated functions

The following functions are part of the interface, but have been deprecated.

val sameAtom : (atom * atom) -> bool

Use same instead.