Re: Prolog doesn't give multiple solutions to my goal.



Benjamin Johnston wrote:
Try ?- compute([put_a,put_x_or_y,put_x_or_y,put_b]), fail.

Most Prolog systems quite stupidly give only one answer to a ground query.
You are not the first one to fall in that unnecessary trap.

Some Prolog systems allow you to change that behaviour.

Just to expand slightly on Bart's reply...

If you press ; (semicolon) or ;<enter> or just <enter> (depending on
your prolog) you may get those other answers that you were expecting.

Actually, Bart's point was that, if the query was ground (variable-free),
some systems do NEVER prompt for a semicolon, even if there are multiple
solutions, e.g. member(a,[a,b,a]).


-- Joachim
.



Relevant Pages