Hello,
On Sat, Oct 24, 2009 at 03:41, metaperl.j <
metaperl.j@...> wrote:
>
> I'm reading some data on how the prolog engine works:
>
http://www.amzi.com/AdventureInProlog/index.htm>
> and was expecting my trace to show a final redo and fail after finding X =
> crackers,
> but for some reason it did not. Instead SWI Prolog immediately showed 'No'
From the documentation for current_prolog_flag/2:
> prompt_alternatives_on(atom, changeable)
> Determines prompting for alternatives in the Prolog toplevel. Default is determinism, which implies the system prompts for alternatives if the goal
> succeeded while leaving choicepoints. Many classical Prolog systems behave as groundness: they prompt for alternatives if and only if the query
> contains variables.
?- [user].
|: edible(apple).
|: edible(crackers).
|: % user://1 compiled 0.00 sec, 744 bytes
true.
?- edible(X).
X = apple ;
X = crackers.
?- set_prolog_flag(prompt_alternatives_on, groundness).
true.
?- edible(X).
X = apple ;
X = crackers ; % <-- Prompts for user input here
false.
The second time, there is a choicepoint left after X = crackers is
found, as you expect.
Hope this helps,
--
Nicolas
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog