r2 - 09 Dec 2007 - 10:14:38 - JanWielemakerYou are here: TWiki >  FAQ Web  > MorePrompt

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

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback