Homework #3 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. As a result, a file should be opened in a text editor.
    2. Add the following line to the file:
      :- set_prolog_flag(editor, pce_emacs).
    3. Save the file and close it.
    4. 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/problem1.pro:5):
            Clauses of foo/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.