Hi.  I'm brand new to Prolog and am having trouble understanding some
of the results I get from the gprolog interpreter.  For instance, the
following simple program is meant to yield 'true' for both c(foo) and
c(bar):

a(foo).
a(bar).
b(foo).

c(X) :- a(X) ; b(X).

But in fact I get this:

| ?- c(foo).

true ? ;

yes
| ?- c(bar).

true ? ;

no

Could someone humor me and tell me why I am prompted for another
result after 'true' (and why the 'yes' after the first result and the
'no' after the second).  I get the same behavior if I use:

c(X) :- a(X).
c(X) :- b(X).

Also, I've had to define my own negation operator because if I try to
compile something like:

d(X) :- not a(X).

...I get an error:

/[...]/test.pl:29 error: syntax error: . or operator expected after
expression (char:13)
       1 error(s)
compilation failed

I've read most of TFM as well as a Prolog tutorial, but I don't see
why this shouldn't work.  Btw. this is gprolog 1.2.16 on i386 Linux.


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

Reply via email to