8.4 Atomic constants
Atomic constants is another kind of term. We have already come across atomic constants, because atomic constants are nothing more than structures with an arity of 0. Thus atomic constants are just functors with no arguments in parentheses.
Atomic constants are also called atoms.
A functor is an identifier
Remember that a functor must be an identifier. An identifier is a sequence of letters, digits, and underscores (_), where the first two characters are letters.
For example, the following are all atomic constants:
What is often the reality behind atomic constants?
Good candidates for atomic constants are single entities with a name. For example, Albert Einstein is a single entity with a name. Therefore, his name is a good candidate for being an atomic constant.
No spaces in atoms
Notice that an identifier (and therefore, an atomic constant), cannot contain spaces. Hence, the following are not atomic constants:
We could instead write these as:
Contracting names with spaces into names without the spaces is common practice in programming.
Another common practice is to place underscores in between the words:
Which we choose doesn't matter, since the identifiers are nothing more than meaningless strings to the computer.
An atomic constant (or simply, an atom) is a structure with arity 0. So it is just a functor. A functor is an identifier. The reality we wish to describe with atoms is often single entities with a name. Atoms cannot contain spaces, because identifiers cannot contain spaces. The two common solutions to this problem is either to contract the words or to place underscores in between the words.
As we know, there are six kinds of terms. So far, we have treated structures, string constants, and atomic constants. If you want to revise what the others are, you can go back to this page. Next, we treat numeric constants.
PrevLite: 8.3 String constants
NextLite: 8.6 Quiz: Terms
Prev: 8.3 String constants
Up: 8 Terms
Next: 8.5 Numeric constants (Ad)