In D, the numbers increase, but not in any predictable fashion. They might be, say, the distance of each point from Carfax.
For each of these, try to write a predicate called next_place(Here,Next)
,
which, given the input argument Here, returns in Next the following
place in the sequence, i.e. if you ask next_place(brasenose,Next).
then Next
should become all_souls
. If you can't see a way fairly quickly, then
leave that part: there may not be one.
Now, consider the four representations again. For each, write out a new
set of clauses describing the street without Brasenose (not a bad idea
anyway). That is, remove whichever clause(s) define(s) it, such that the
remaining clauses still represent a connected map, and so that next_place
still works.
Next write out a new set of clauses for each so that they describe the
street with a new point added, say The Body Shop. Again, next_place
must
still work on these new clauses.
Finally, for each of the four representations, try writing the predicate
nth_point(N,P)
, which is given a number N as input, and which sets P
to the Nth point in the sequence. Thus, nth_point(2,P).
should set P
to brasenose
. Again, if you can't see fairly quickly how to do it,
leave that part.