Skip to main content
Version: Next

term_to_atom/2

Description

term_to_atom/2 is a predicate that describes Atom as a term that unifies with Term.

Signature

term_to_atom(?Term, ?Atom)

where:

  • Term is a term that unifies with Atom.
  • Atom is an atom.

When Atom is instantiated, Atom is parsed and the result unified with Term. If Atom has no valid syntax, a syntax_error exception is raised. Otherwise, Term is “written” on Atom using write_term/2 with the option quoted(true).

Example

# Convert the atom to a term.
- term_to_atom(foo, foo).