|
Lecture 3: Writing and running recursive Prolog programs
- rules allow us to write conjunctive queries
more concisely and to reuse them;
- recursive programs describe uncertain and
unpredictable situations;
- recursive structures need to be processed
recursively.
|
|
How to prepare
|
|
|
- Work your way through Tutorial Sheet 1.
- Consider situations where there is an
unknown number of "solutions", for
instance, enumerating all of a
person's friends.
- Consider how you would visit every
node of a binary tree - where you
don't know in advance the depth of
the tree and how many leaves it has.
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|