9.1 Function-definition block

User-defined functions appear in a special function-definition block before all of the other program blocks.

functions {
   // ... function declarations and definitions ...
data {
  // ...

Function definitions and declarations may appear in any order, subject to the condition that a function must be declared before it is used. Forward declarations are allowed in order to support recursive functions.