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

2.10 Rules

A function rule is an item of the form ‘Head = Result :- Body’. A predicate rule is an item of the form ‘Head :- Body’ where the top-level functor of ‘Head’ is not =/2. In both cases, the Head term must not be a variable. The top-level functor of the Head determines which predicate or function the clause belongs to; the predicate or function must have been declared in a preceding ‘pred’ or ‘func’ declaration in this module. The Result and the arguments of the Head must be valid data-terms (optionally annotated with a mode qualifier; see Different clauses for different modes). The Body must be a valid goal.