Prolog Assignment FAQ

  1. In class you showed us a special editor that colorizes the Prolog program. How do I use this editor?

    The editor I used in class (called PCE Emacs) comes with your SWI Prolog download. However, the default install is configured to use your normal text editor (usually Notepad). In order to make PCE Emacs the default editor from SWI Prolog, do the following

    1. Select Settings -> User init file... from SWI Prolog's menu bar.
    2. The system will say that it could not find an initialization file, and ask if you want to create one. Respond yes. As a result, a file should be opened in a text editor.
    3. Find the following line in the file:
      % :- set_prolog_flag(editor, pce_emacs).
    4. Remove the initial "%", effectively uncommenting the line. It should look like:
      :- set_prolog_flag(editor, pce_emacs).
    5. Save the file and close it.
    6. Close and restart SWI Prolog. Now when you use the New or Edit menu options, PCE Emacs should be the default editor.
  2. When I compile my Prolog code, I get an error such as:
    Warning: (c:/program files/prolog/
            Clauses of likes/2 are not together in the source-file
    % problem1 compiled 0.00 sec, 0 bytes
    What does this mean?

    Generally, Prolog programs are easier to read when all of the clauses with the same head are grouped together. Note, this is not required, which is why it is only a warning and not an error. To make the message go away, simply make sure all rules with the same functor in the head (i.e., left hand side) and all facts with the same functor are on consectutive lines.