To create a Prolog program, you must use an editor to create a file. There are a
number of editors available and you can use whatever you prefer. If you have no
preference, I suggest using the emacs editor that comes with SWI-prolog. It is
Prolog-aware and will format and colour-code Prolog programs for you, as well as
providing a number of other Prolog-related conveniences. To use emacs on a
networked Windows machine, use the following instructions. (In the elab, this has
already been set up.)
- Start Prolog (by double-clicking the shortcut to plwin.exe on your
desktop).
- From the Menu bar select Settings|User init file
- Scroll down the file until you see
%:- set_prolog_flag(editor, pce_emacs).
- Delete the percentage sign at the beginning of the line.
- Save the file (Either Save from the File menu, or use the key combination
Ctrl-x Ctrl-s — that is, hold down the Control key and type xs).
- Quit Prolog. Next time you start Prolog, the emacs editor will be available.
Here is how you create a Prolog program.
- Double-click the Prolog program icon.
- Use the File menu of the resulting window to create a new file and give it
a name, with the extension .pl, making sure you save it in a location to
which you are allowed to write files.
- If you are using a networked Windows machine, this will mean
somewhere on your your H: drive.
- If you are in the elab, you have two choices
- Save it to the elab server: <username> on ’jigsawxp1’ (U:).
(Where <username> is your username.) The drawback to this is that
your files are then only accessible from the elab computers.
- Save it on your networked filestore; it will then be accessible both
from the elab and elsewhere on campu. To do this follow these
instructions
- From the Start menu, Choose My Network Places and then
select Add Network Place from the pane on the left
- This opens the Add Network Place Wizard; respond by clicking
Next until you get the invitation to enter an Internet or network
address.
- Type \\userfs.york.ac.uk\<username> (where <username> is
your username).
- Your username should be entered in the form
<username>@york.ac.uk
- You will be able to access your network filestore via My Network
Places.
- Enter the text of your file in the file window.
- You save your file by using the Save option from the File menu on the menu bar
at the top of the editor’s window.
- Make sure that you give your Prolog files the extension .pl .
- You can copy text in the usual manner by using Copy and Paste from the Edit
menu, or by selecting the text with the cursor (this copies automatically) and
using using the key combination Ctrl-y to paste.
- The same procedures work in the SWI-Prolog window; select the text to copy
and use Ctrl-y to paste.