# The SML/NJ Library Reference Manual

### The `ATOM` signature

The Atom structure provides hashed strings with fast equality testing.

#### Synopsis

> `signature `ATOM`
> structure `Atom` : ATOM
> `

#### Interface

> `type atom
> val atom : string -> atom
> val toString : atom -> string
> val sameAtom : (atom * atom) -> bool
> val compare : (atom * atom) -> order
> val hash : atom -> word
> `

#### Description

`type atom`
  Atoms are hashed strings that support fast equality testing.
`atom s`
  creates an atom out of the string s. Two calls to atom with the same argument will return the same atom.
`toString at`
  returns the string that the atom at was created from.
`sameAtom (at1, at2)`
  returns `true`, if the two atoms are the same. This is a constant-time equality test.
`compare (at, at2)`
  returns the relative order of the two atoms according to some internal ordering. Note that this is not the lexical ordering of the string representations of the atoms.
`hash at`
  returns a hash value for the atom at.

#### See Also

> AtomMap, AtomSet, AtomTable

[ INDEX | TOP | Parent | Root ]

Last Modified May 29, 1996
Copyright © 1996 AT&T Research