4.15 Declaring predicate properties
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Declaring predicate properties
          • dynamic/1
          • dynamic/2
          • mode/1
          • compile_predicates/1
          • multifile/1
          • discontiguous/1
          • public/1
          • non_terminal/1
    • Packages
Availability:built-in
mode +Head, ...
Define the modes for the predicates referenced by the comma-separated list Head. Each argument of each head is a mode specifier. Defined specifiers are +, - and ?. Mode declarations have a long history in Prolog. This predicate uses the definitions derived from e.g., Quintus Prolog and used for documentation in the ISO standard. The specifiers declare whether or not an argument is unbound at call time. The + declares that the argument is nonvar/1, the - declares the argument is var/1 and ? makes no claim.

Several Prolog systems define mode as an operator using the declaration below. Currently we do not define the operator.

:- op(1150, fx, mode).

SWI-Prolog uses the mode information for its just-in-time clause indexing as described in section 2.17. JIT only uses the - specifier to avoid examining that argument as a candidate for indexing.