users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possibly impertinent question about GProlog (1.4.4) results when working


From: Donald Winiecki
Subject: Possibly impertinent question about GProlog (1.4.4) results when working exercises in `Learn Prolog Now!`
Date: Thu, 6 Aug 2015 09:50:58 -0600

​​
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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]