foo(bar) prolog(a, X) hilog(X) 123(john, 500) X(kostis, sofia) X(Y, Z, Y(W)) f(a, (b(c))(d)) map(double)([], []) h(map(P)(A, B))(C)

Like a functor in Prolog, a functor in HiLog can be characterized by
its * name* and its * arity* which is the number of arguments this
functor is applied to. For example, the compound term whose principal functor
is ` 'map(P)'` of arity 2, and which has arguments ` L1`, and ` L2`,
is written as:

map(P)(L1, L2)

As in Prolog, when we need to refer explicitly to a functor we will normally
denote it by the form . Thus, in the previous example, the functor
` 'map(P)'` of arity 2 is denoted by:

map(P)/2Note that a functor of arity 0 is represented as an atom.

In Prolog, a compound term of the form is usually pictured as a tree in which every node contains the name of the functor of the term and has exactly children each one of which is the root of the tree of terms .

For example, the compound term

s(np(kostis), vp(v(loves), np(sofia)))would be pictured as the following tree:

s / \ np vp | / \ | v np | | | kostis loves sofia |

The principal functor of this term is ` s/2`. Its two arguments are also
compound terms. In illustration, the principal functor of the second
argument is ` vp/2`.

Likewise, any external representation of a HiLog compound term can be pictured as a tree in which every node contains the tree representation of the name of the functor of the term and has exactly children each one of which is the root of the tree of terms .

Sometimes it is convenient to write certain functors as * operators*.
* Binary functors* (that is, functors that are applied to two arguments)
may be declared as * infix operators*, and * unary functors* (that is,
functors that are applied to one argument) may be declared as either
* prefix or postfix operators*.
Thus, it is possible to write the following:

X+Y (P;Q) X<Y +X P;More about operators in HiLog can be found in section 4.3.