1.4.3. Posing a
goal
To get Prolog to do some computation, you need to issue a goal.
Type
| ?- grandmother(liz, Who).
Type this exactly, including the capital W and the final full-stop,
and, hit <return>. Prolog will
respond:
[1]
Who = harry
Next, type a semi-colon followed by <return>. Prolog will
respond
Who = wills
Again, type a semi-colon followed by <return>. Prolog will
respond:
no
This means that you have now received all the responses to the goal
that Prolog can compute on the basis of the information supplied in your program
file. When Prolog searches for alternative ways of satisfying a goal, this is
know as ‘backtracking’.
[1] If
nothing happens, 1) check your typing, 2) make sure you haven't forgotten the
full-stop.