Prolog Language Data Structures Terms


On a very high level, Prolog only has a single data type, called term. In Prolog, all data is represented by Prolog terms. Terms are defined inductively:

  • an atom is a term. Examples of atoms are: x, test and 'quotes and space'.
  • a variable is a term. Variables start with an uppercase letter or underscore _.
  • integers and floating point numbers are terms. Examples: 42 and 42.42.
  • a compound term is a term, defined inductively as follows: If T1, T2, ..., T_n are terms, then F(T1,T2,...,T_n) is also a term, where F is called the functor of the compound term.