Reputation: 2824
When I run query human(Who).
on the below .pl
file
human(ann).
human(george).
human(mike).
I only get back Who = ann .
Instead of
Who = ann ;
Who = george ;
Who = mike.
Am using prolog 6.6.6. How do I get it to show the full list?
Upvotes: 1
Views: 344
Reputation: 10102
The answer you got was the following. Do you note the space before the dot?
Who = ann .
^ SPACE!!!
This space means: The query was aborted. Maybe you typed return. Or maybe you have a somewhat illconfigured terminal.
To better check this, try:
?- X = 1 ; X = 2 ; X = 3.
There you should get all three answers, too. If not, it is definitely your terminal
Upvotes: 2
Reputation: 1945
What you are seeing is the default behaviour of prolog.
The query
?- findall(Object,Goal,List).
Should work for you.
Eg.
findall(X, human(X), L).
It will populate the list with all possible answers.
Upvotes: 0