Work in pairs!
Two or three pages of notes on what you have learned.
These notes can be on paper or online. The can be put
on the web if you want.
End of lab
How to use Prolog
To run tests use the command
plif it works. I've installed a link to the SWI Prolog system as
/share/bin/pland you may either need to give the full path name
/share/bin/plor add /share/bin to your shell PATH.
To test a Prolog program in a file called forExample.plg use
If /share/bin/pl doesn't exist or fails to run you may have to use
gprologin its place.
The Gnu version of Prolog is similar but some predicates
are different and it doesn't seem to work as well on some
Help in Prolog
Start up Prolog and try the following queries out...
Don't forget the '.' at the end of each query.
help(member).The notation name/arity which means: the predicate with functor name and arity arguments. The signs on the arguments in the description say whether they have to be in or out arguments - whether you supply a value or if the predicate will supply the value. Sometimes either can happen as is needed.
Getting lists of helpful topics on a given subject:
Sherlock Holmes is using a computer("The Engine") to investigate the murder at the Metropolitan Club. Read the handout first....
Find and download(Shift/click, and "Save as" text) a copy of
http://www.csci.csusb.edu/dick/cs320/prolog/metro1.plg[ metro1.plg ] You can run Prolog with UNIX command
plTell the interpreter to compile the facts of the case into database.
^Don't forget the period.You can now investigate the murder. What happens when you input these lines?
listing(hair).Don't forget the periods, and the case of everything is lower case.
Then try inputting this query:
murderer(X).Don't forget the periods, and the case of X.
We will now ask Prolog to show us, step by step how it solved the crime:
trace, murderer(X).Keep tapping return as each step is taken. ("creep" is not intended to be insulting... it indicates that the system is taking a very small step forward or backward).
From the Book
Try out the examples in the book on pages 195..211.
Be careful to create the database/rule files before you start to run the Prolog interpreter, see [ 17.html ] for guidance.
Work in pairs: one dictate and one type.
To get credit show me notes and anything odd that happens.
Study these hints if unexpected things happen...
End of line does not count.
X is a variable - with an unknown (as yet?) value.
x is the atom x
export EDIT VISUAL EDITOR
The next time you login most UNIX programs will know what editor you like to use.
. . . . . . . . . ( end of section CSci620 Programming Languages -- Hello, Prolog!) <<Contents | Index>>