Prolog Source Code Layout Restrictions

There are some restrictions on program layout, which are necessary for <ESC> k p (compiling a procedure), <ESC> . (find-definition) and for indentation in prolog mode to work properly. In order for these commands to function correctly, you must:

  1. Group Prolog clauses of the same name and arity together. That is, do not intersperse clauses of one procedure with clauses of another. Normally breaching this restriction will cause a style warning (see bas-lod-sty).
  2. Start the heads of all Prolog clauses at the beginning of the line; indent any additional lines for those clauses. Within prolog mode the TAB and the <LFD> can be used for indenting the current line as prolog code.
  3. If a comment continues onto another line, indent the continuation line(s).
  4. Do not write clause definitions that use operators in the heads of the clauses. For example, if you want to define clauses for +/2, then write the head of the clause in the form +(A, B) and not A + B.