[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Understanding GNU vs SWI differences
From: |
Alberto Simões |
Subject: |
Understanding GNU vs SWI differences |
Date: |
Tue, 7 Aug 2012 15:10:49 +0100 |
Hello
I am sorry if this is a trivial issue, that is explained somewhere. If
so, please point me in that direction.
Nevertheless, when doing some experiments with SWI Prolog and GNU
Prolog, I found out some different behavior on some simple things:
This is my SWI Prolog run:
?- [user].
|: f(a,b).
|: f(c,d).
|: f(a,d).
|: % user://1 compiled 0.00 sec, 5 clauses
true.
?- f(X,b).
X = a.
?- f(a,X).
X = b ;
X = d.
?- f(X,d).
X = c ;
X = a.
In fact, SWI Prolog never says true/false/yes/no. It just show the
possible results.
In GNU Prolog I get this:
| ?- [user].
compiling user for byte code...
f(a,b).
f(c,d).
f(a,d).
user compiled, 4 lines read - 331 bytes written, 9192 ms
yes
| ?- f(X,b).
X = a ? ;
no
| ?- f(a,X).
X = b ? ;
X = d
yes
| ?- f(X,d).
X = c ? ;
X = a
(1 ms) yes
Although I can understand the 'yes' answer, I can't get why in the
first iteration GNU Prolog stopped and gave me the chance to ask for
more solutions (while in the next two it didn't). And, why did it say
"no" (ok, it said no because it didn't find any other solution, but
then, why did it try to get more solutions in that case?)
Thank you
Kindest regards,
Alberto
--
Alberto Simões
- Understanding GNU vs SWI differences,
Alberto Simões <=