|
Lecture 2: Writing and running simple Prolog programs
- revision of unification;
- introducing facts;
- Prolog use of unification when searching for clauses;
- writing rules that use facts;
- how Prolog works - its "hidden" data structure.
|
|
How to prepare
|
|
|
- Work your way through Tutorial Sheet 1.
- Ensure you understand the difference between
- comparison operators (such as ==/2,
\==/2, =:=/2, =\=/2)
- the more powerful arithmetic operator (is/2)
- the very much more powerful unification (=/2)
- Work through Part 2 of Tutorial Sheet 1 to ensure you understand
how Prolog passes information into and out of a rule.
|
|
|
|
|
Slides
|
|
|
If you really want the slides from the lecture ...
but don't forget printing the slides is not the same as understanding them.
|
|
|
|
|
Programs from the lecture
|
|
|
|
|
|
|
|
|