Why is SWI-Prolog giving me the first answer?

I am new to Prolog. I'm just trying to find simple examples. I have this .pl file with these lines:

 parent(pam,bob). parent(tom,bob). parent(tom,lio). parent(bob,ann). parent(bob,pat). parent(pat,jim). 

After consultation and testing, he shows only the first answer. For example:

 5 ?- parent(X,Y). X = pam, Y = bob . 

Shouldn't he give all combinations satisfying the parent relation?

Does anyone know what the problem is?

+7
prolog prolog-toplevel
source share
1 answer

don't hit the input after your first results are shown, use a space instead

  • [Enter] stops execution even if backtracking has not yet completed
  • [Spacebar] or [;] continues with a return from your last result to the next result, or false if there are no other results.
+8
source share

All Articles