likes(john, pizza).Atoms of this type must start with a lower case letter. They can include digits (after the initial lower-case letter) and the underscore character (
. This is a strange one: other lists are not atoms. If you think of an atom as something that is not divisible into parts (the original meaning of the word atom, though subverted by subatomic physics) then
being an atom is less surprsing, since it is certainly not divisible into parts.
===>. When using atoms of this type, some care is needed to avoid using strings of special characters with a predefined meaning, like the neck symbol
:-, the cut symbol
!, and various arithmetic and comparison operators.
Numbers, in Prolog, are not considered to be atoms.
atom is also the name of a built-in
predicate that tests whether its
single argument is an atom.
?- atom(pizza). true. ?- atom(likes(mary, pizza)). false. ?- atom(<-->). true. ?- atom(235). false. ?- X = some_atom, atom(X). X = some_atom.The final example means that
atom(X)has succeeded, with