signature ATOM structure Atom : ATOM where String = String
This structure provides an efficient representation for strings that guarantees that equal strings share their representation. Such strings are also known as internalized string, symbols, or atoms.
See also: STRING, SUBSTRING, HASHABLE, ORDERED
import signature ATOM from "x-alice:/lib/data/ATOM-sig" import structure Atom from "x-alice:/lib/data/Atom"
signature ATOM = sig eqtype string eqtype atom type t = atom val atom : string -> atom val toString : atom -> string val equal : atom * atom -> bool val compare : atom * atom -> order val hash : atom -> int end
The type of uniquely represented strings. Equality is defined structurally.
Creates an atom with content s. If an atom with the same content already exists, that one is returned.
Extracts the content of the atom a. It holds that
toString (atom s) = s
An explicit equality function on atoms. Equivalent to op=.
Defines an ordering on atoms. Comparison is intended to be constant time. Note that the ordering is not lexicographic.
A hash function for atoms. Hashing is constant time.