[Top][All Lists]

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

Differences between GProlog and SWI-Prolog results: Question about excer

From: Donald Winiecki
Subject: Differences between GProlog and SWI-Prolog results: Question about excercises in `Learn Prolog Now!`
Date: Sat, 8 Aug 2015 05:59:18 -0600

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.

I acknowledge this to be a very low-importance issue.

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 don't understand why GProlog stops when it hits the rule "magic(X):- wizard(X)." Any pointers are terrifically appreciated!

Text of the exercise follows:

Exercise 2.2

We are working with the following knowledge base:

magic(X):- house_elf(X).
magic(X):- wizard(X).
magic(X):- witch(X).

Which of the following queries are satisfied?...

1. magic(housde_elf).
2. wizard(harry).
3. magic(wizard).
4. magic('McGonagall').
5. magic(Hermoine).


reply via email to

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