8 Terms

Six kinds of terms

In Prolog, as in many programming languages, a number of different kinds of data are available. For example, numbers and strings are two of the ones available in Prolog. In Prolog, all of the kinds of data are grouped under the general heading of "term". Here is a complete list of all of the different kinds of data available in standard Prolog (Prolog+CG has a few others in addition to these -- we will get back to them later):

  • Term
  • Structure
  • Number
  • String
  • Atom
  • List
  • Variable

For now, we will not go into detail with what these are and what they mean. We will save the details for later. Instead, we will just give an example of what each of the six different kinds of data looks like:

  • Structure:
    date(1, September, 1939)
  • Number:
    18
  • String:
    "This is a string - a sequence of characters"
  • Atom:
    September
  • List:
    (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday) 
  • Variable:
    X


PrevLite: Part III: Programming
NextLite: 8.1 Relationships

Prev: Part III: Programming
Up: Part III: Programming
Next: 8.1 Relationships