Querying with the route/2
procedure |
|
You are advised to complete your solution
before you look at the answer. |
|
|
Using the route/2 and path/2 procedures, which
of the following queries are true and to what would the variables be instantiated?
|
|
|
|
|
1.
|
route(a, 1). |
|
2.
|
route(1, 5). |
|
3.
|
route(3, b). |
|
4. |
route(9, 5). |
|
|
|
|
With the following queries, type a semi-colon (";") after
each reply from Prolog until you get the "no" response: eg
| ?- route(7, End).
End = b ? ;
End = 8 ? ;
End = b ? ;
no
|
|
5.
|
route(4, End). |
|
6.
|
route(Start, 5). |
|
|
|
|
|