users-prolog
[Top][All Lists]
Advanced

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

Re: Differences between GProlog and SWI-Prolog results: Question about e


From: Donald Winiecki
Subject: Re: Differences between GProlog and SWI-Prolog results: Question about excercises in `Learn Prolog Now!`
Date: Tue, 18 Aug 2015 22:22:36 -0600

On Tue, Aug 18, 2015 at 5:15 PM, "Michał Bieliński" <address@hidden> wrote:
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

​Indeed. I was hoping my question would be forgotten, even though I have been building courage to report that the problem was, as they say, `the loose nut on my keyboard`.

Both SWI-Prolog and GProlog were behaving properly and identically (though reporting the missing definition in their own ways).  The problems were all mine.  Very basic Prolog syntax was being munged by myself, and misinterpreted on top of it all. 

I've been spending a lot of time in Common Lisp the last few weeks but endeavour to get back here soon.
 

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.

--
Michał

​Best,

_don​
 

reply via email to

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