Possibly impertinent question about GProlog (1.4.4) results when working exercises in `Learn Prolog Now!`

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possibly impertinent question about GProlog (1.4.4) results when working exercises in `Learn Prolog Now!`

Donald Winiecki
​​
Apologies in advance for:

Asking what might not be a relevant question in this list.
Asking a flatly novice question.

Relative to the online instructional material in `Learn Prolog Now!`, exercise 2.2

It appears to be the case that GProlog returns different results than does SWI-Prolog on question 5 in exercise 2.2.

Text of the exercise is at the bottom of this message.

SWI-Prolog 7.2.2 returns:

?- magic(Hermoine).
Hermoine = dobby ;
Hermoine = hermoine ;
Hermoine = 'McGonagall' ;
Hermoine = rita_skeeter .


GProlog 1.4.4 returns

?- magic(Hermoine).
Hermoine = dobby ? ;
uncaught exception: error(existence_error(procedure,wizard/1),magic/1)

I understand SWI-Prolog's results, but can't understand why GProlog stops when it hits the rule "magic(X):- wizard(X)."

Any pointers or cautions away from posting such questions in this list are terrifically appreciated!

Text of the exercise follows:

Exercise 2.2
We are working with the following knowledge base:

%%%%%%%%%%%%%%%%%%%%%%%%%​

house_elf(dobby).
witch(hermoine).
witch('McGonagall').
witch(rita_skeeter).
magic(X):- house_elf(X).
magic(X):- wizard(X).
magic(X):- witch(X).

Which of the following queries are satisfied?...
1. magic(house_elf).
2. wizard(harry).
3. magic(wizard).
4. magic('McGonagall').
5. magic(Hermoine).

​%%%%%%%%%%%%%%%%%%%%%%%%%​

​Best wishes,​

_don

_______________________________________________
Users-prolog mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/users-prolog