SWI-Prolog 5.6.59 Reference Manual: Section 5.3

## 5.3 Defining a Module

Modules normally are created by loading a module file. A module file is a file holding a module/2 directive as its first term. The module/2 directive declares the name and the public (i.e., externally visible) predicates of the module. The rest of the file is loaded into the module. Below is an example of a module file, defining reverse/2.

    :- module(reverse, [reverse/2]).

    reverse(List1, List2) :-
            rev(List1, [], List2).

    rev([], List, List).
    rev([Head|List1], List2, List3) :-
            rev(List1, [Head|List2], List3).