Compound Syntax

The simplest form of structuring terms is the compound. The compound consists of a name followed by one or many arguments. The principal name is called the functor and the number of arguments is called the arity. To disambiguate from operator expressions a compound is only recognized when the name directly precedes the left parenthesis (“(”).

compound   --> "{" term(1200) "}"
   | atom "(" arguments ")"
   | atom "(" ")".

arguments --> term(999) { "," term(999) }.

Examples:
f(a,b)         % is a compound
{} % is the empty set, corresponds to '{}'
{a}            % is a compound, corresponds to '{}'(a)
-(a,b)         % is a compound, corresponds to a - b
- (a, b) % is an expression, corresponds to - ,(a, b)

By means of the braces (“{}”) a form of set notation can be invoked. The empty set notation is just a short hand for the name ‘{}’. The set notation that surrounds a term is a compound of arity one with the functor ‘{}’. Since the empty set {} and the empty list [] do belong to the category of atoms they can be used as a functor as well.

Kommentare