Navigating through data structures (PE,AI)


next up previous
Next: Science fiction stories
Up: Supplement 4
Previous: Abstract individuals
Back: to main list of student notes

Navigating through data structures (PE,AI)

Generally, Prolog programs often fall into two parts. One is fixed data - networks, family trees, and so on - described by structural predicates like meets and is_a; the other is some component which wanders around it, changing facts, generating output, reading input, and so on. You have already had some practice at expressing the fixed data, and in Lessons 7 and 8, you will get an idea of how to do the navigation. To prepare you for this, some examples of what you can do by navigating are shown in the rest of this supplement. While reading them, you may like to bear in mind the following quote:

A German with starving wife and family sought assistance from the Winter Aid Fund. Entering an imposing building, he found himself facing two doors, one marked ``Party Members'', the other ``Non-Party Members''. Going through the second door he was faced with two more, one marked ``Subscribers to the Fund'', and the other ``Non-Subscribers to the Fund''. Going through the latter, he was once again faced with two more doors, and so on. After an hour or two, having come to two doors, one marked ``Single Men'', the other marked ``Family Men'', he chose the latter and found himself out in the street where he had started. A friend asked him whether he had got any help. ``No'' he said, ``but heavens, what organisation!''.




next up previous
Next: Science fiction stories
Up: Supplement 4
Previous: Abstract individuals
Back: to main list of student notes



Jocelyn Paine
Tue Jun 4 17:58:48 BST 1996