[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Differences between GProlog and SWI-Prolog results: Question about e
Re: Differences between GProlog and SWI-Prolog results: Question about excercises in `Learn Prolog Now!`
Wed, 19 Aug 2015 01:15:04 +0200
Dnia 8 Sierpnia 2015, 13:59, So, Donald Winiecki napisał:
> I have a question about exercise 2.2 in LPN!.
> In particular, it appears to be the case that GProlog returns different
> results than does SWI-Prolog on question 5 in exercise 2.2.
The heart of the problem is the clause:
magic(X) :- wizard(X).
In the program code predicate wizard is referenced but defined nowhere.
> I understand SWI-Prolog's results, but don't understand why GProlog
> stops when it hits the rule "magic(X):- wizard(X)." Any pointers
> are terrifically appreciated!
I have the opposite problem! I understand GNU Prolog's approach but fail
to grasp why SWI does not signal missing definitions by default. :-p
Anyway, how the solver behaves when it hits nonexistent procedure is
configurable. Use set_prolog_flag(unknown, X) where X can be 'error',
'fail' or 'warning' to change it.