Next: , Previous: , Up: Syntax   [Contents][Index]

### 3.5 Function calls

A function call is a either simple compound term where the functor is the name of a primitive or program defined function, or it is a non-simple compound term where the compound term that denotes the functor is a function call that returns a function value.

For certain binary primitive functions the functor name may be used as an infix operator and placed between the two arguments. This holds for the usual binary arithmetic operators `+`, `*` etc. for which function applications are written as expressions such as `6+9*X`.

The special zero argument functions `e_` and `pi_`, invoked as in expressions `e_()` and `pi_()`, evaluate to the numbers ’e’ and ’pi’. More details are given in Arithmetic.

In the QuLog interpreter a function call, indeed any expression, can be given as an entry to be evaluated.

Examples:

```| ?? 67.7/2.3.

29.4348 : num

| ?? curryR(child_of)(peter).

curryR(child_of)(peter) : (atom)<=
% The denoted value is a relation over atom names
```

Function calls denote expressions that contain no function calls. That is they denote non-variable terms: atomic values, code names, simple compound terms all the arguments of which are non-variable terms, lists or sets of non-variable terms. The exceptions are certain code returning function calls which are only evaluated when the code value they denote is itself called. The above `curryR(child_of)(peter)` is an example. It denotes an unary relation but that relation is only used when the unary relation is called in a query such as:

```| ?? P ? Rel=curryR(child_of)(peter) & Rel(P).

P = harry : atom
...
P = mary : atom
```

Next: , Previous: , Up: Syntax   [Contents][Index]