Program components


next up previous contents
Next: Example of structure-processing: complex numbers.
Up: Introduction to Prolog for Mathematicians
Previous: Clauses

Program components

Predicate names start with a lower-case letter. Example: is_a, diff.

The arguments to predicates can be any term:

Atoms.
Arbitrary names, used as logical constants. They must start with a lower case letter.

Example: x, identity_1.

Numbers.
Integers or floating-point numbers.

Example: 2, -25.39.

Variables.
Arbitrary names used as logical variables. They must start with a capital letter.

Example: X, N_plus_1.

Structures.
An -tuple of terms, prefixed by an atom, the functor.

Example: vec3(0,1,0), mat2( vec2(1,0), vec2(0,1) ).

Lists.
Sequences. Lists are actually a type of structure, but have a special syntax.

Example: [the,dog,bit,the,cat], [], [ [1,0,0], [0,1,0], [0,0,1] ]



Jocelyn Ireson-Ireson-Paine
Mon Jul 17 22:27:41 BST 1995