SWI-Prolog prompts using "more?"
SWI-Prolog has two modes for prompting after proving a toplevel goal that is controlled by the
Prolog flag
prompt_alternatives_on. Classical Prolog systems prompt for alternatives if the toplevel goal
contains variable, regardless whether or not Prolog
knows there are no alternatives. This mode is
supported by the value
groundness for the
prompt_alternatives_on flag.
By default however,
prompt_alternatives_on is set to
determinism, which means Prolog prompts
for alternatives if the goal succeeded with at least one choicepoint. So, a goal as below indeed prompts
for the proper alternatives.
test :-
member(X, [hello, world]), writeln(X).
?- test.
hello
More? ;
world
More? ;
No
?-
Especially for the more serious developer, it is important that predicates that are designed to leave
no choicepoints actually behave like this. This current prompt mode often spots such problems during
the debugging phase, where developers often run test queries from the toplevel. You can use the
graphical debugger (gtrace/0) to find the choicepoint.
--
JanWielemaker - 08 Dec 2007