Notes and Errata for "A Concise Introduction to Prolog"
David Matuszek
These are some notes on the differences between SWI-Prolog and the version of Prolog that I used when writing my Concise Introduction to Prolog.
member/2 and append/3 are defined in SWI-Prolog (the
paper says they are not).
restore/1 is not defined in SWI-Prolog.
So far, the only way I've been able to consult a file is by using a full path name. (I'm
pretty sure this is just a minor problem with my configuration, but I haven't had time to
look into the problem.)
Unix-style forward slashes are accepted:
consult('C:/WINDOWS/Start
Menu/Programs/SWI-Prolog/examples.pl').
DOS-style backslashes are accepted, but have to be doubled:
consult('C:\\WINDOWS\\Start
Menu\\Programs\\SWI-Prolog\\examples.pl').
If you accidently get
Action (h for help) ?
just hit an a (for "abort").
If you accidently get
% Break level 1
hit control-D.
If Prolog gives an answer but does not follow it with a new prompt, there may be other
answers. Hit ; (semicolon) for the next answer, or <return> to get a
new prompt.
Use \+ for "not," for example, child(X) :- human(X), \+
man(X), \+ woman(X).
Use consult/1 instead of reconsult/1. (SWI-Prolog doesn't even
define reconsult/1; it just defines consult/1 to do what reconsult/1
does in other dialects.)
Some versions of Prolog, including Quintus and SWI, require that predicates which may be asserted or retracted must be declared as "dynamic." An example of a dynamic clause is:
:- dynamic at/2, i_am_at/1, alive/1.
As part of your assignment, you must turn in a transcript of a sample run of your program.
Warnings:
Any significant improvements to this procedure will earn someone another 10 points of extra credit.