next up previous contents
Next: (Compound) Terms as Up: Prolog Syntax Previous: Variables

Compound Terms

A Compound Term is a functor with a (fixed) number of arguments each of which may be a Prolog term.

This means that we can arbitrarily nest compound terms. For some examples:


principal functor = happy

1st argument = a constant (atom)


principal functor = sum

1st argument = constant (integer)

2nd argument = variable


principal functor = not

1st argument = compound term

Nesting compound terms may be of use to the programmer. For example, the clause


is not as informative as

which can be thought of as defining a PASCAL-type record structure.

Paul Brna
Mon May 24 20:14:48 BST 1999