[top] [up] [next]

Terms


The Prolog system recognizes the type of a term object by its syntax. A variable always starts with an uppercase character and all other data types start with a lowercase character. Below there is a picture showing the hierarchy of types in Prolog:

Atoms

Atoms are strings that consist of:

Numbers

These are integer numbers like, 33, -33, 0, 23534 and floating point numbers like, 23.3e+34, -0.3532e-03. For the maximum and minimum values see the page 'Differences and limitations'.

Variables

Variables start with an uppercase character and then consist of alphanumeric characters or the underscore character. Below there are some examples of variables:

    Var
    X
    Hello_this_is_a_variable

A variable that just consists of a single underscore characters is called an anonymous variable.

Structures

Structures are data objects that consist of one or more other components, these can in turn also be structures. These components are bounded by a functor. A functor is an atom that binds the components. Below there are several examples of structures:

    mother(clair, jil).
    point(12, 2).
    functor_1( g(h, i), other_compound_term(A, b) ).

The arity of a structure is the number of components, the arity of point(12, 2) is 2 and the arity of triangle( 12, 2, 15) is 3.

[top] [up] [next]

 

info@trinc-prolog.com