¨

10.2.10 Compound Terms

A compound term is a structured data item that consists of a functor followed by a sequence of one or more arguments which are enclosed in brackets and separated by commas. The general form of a compound term is:

functor( t 1 , t 2 , …, t n ) n ³ 1
functor is the functor. It can be an atom or a variable name. (For further details about the use of a variable name as the functor please see the section below entitled "Meta-variables").
The term t i represents the i’th argument of the compound term. The arity of a compound term is the number of arguments it has (n in the example above). We refer to functor with arity n using the notation: functor/ n The following are examples of compound terms:

A compound term can be thought of as representing a record structure. The functor represents the name of the record, while the arguments represent the record fields. Certain functors can be written as operators. For more information see the section below entitled "Operators". Note: There must be no space between the functor and the opening parenthesis of a compound term.rm the body of the rule. Prolog then