5.8 Operators and modules

Operators (section 4.24) are local to modules, where the initial table behaves as if it is copied from the module user (see section 5.10). In addition, operators can be declared in the module/2 directive as shown below. Such operator declarations are visible inside the module and importing such a module makes the operators visible in the target module. Exporting operators is typically used by modules that implements sub-languages such as chr (see chapter 7). The example below is copied from the library library(clpfd).

:- module(clpfd,
          [ op(760, yfx, #<==>),
            op(750, xfy, #==>),
            op(750, yfx, #<==),
            op(740, yfx, #\/),
            ...
            (#<==>)/2,
            (#==>)/2,
            (#<==)/2,
            (#\/)/2,
            ...
          ]).