users-prolog
[Top][All Lists]
Advanced

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

Questions about Answers


From: Jeff Pitman
Subject: Questions about Answers
Date: Fri, 19 Oct 2001 23:17:44 -0700 (PDT)

Just beginning to make my first steps into Prolog
using gprolog.  Going through some of the tutorials on
the web, I have found a few quirks and differences.  I
was wondering, given:

adjacent(1,2).         adjacent(2,1). 
adjacent(1,3).         adjacent(3,1). 
adjacent(1,4).         adjacent(4,1). 
adjacent(1,5).         adjacent(5,1). 
adjacent(2,3).         adjacent(3,2). 

and then the query:

adjacent(X,1).

responds with:

X = 2 ?
X = 3
X = 4
X = 5

no

But, the query:

adjacent(1,X).

responds with:

X = 2 ?
X = 3
X = 4
X = 5

yes

It seems that most implementations of Prolog will
always return "no" at the end of a list.  However, in
gprolog, this is nondetermistic.  You can shorten the
above list to 2 items, run the same queries and get
two yes's at the end.  Why?

Also, when running atomic queries against the
knowledgebase I always get:

true?

Most information about Prolog never mentions this.  Is
there a way to deal with "true?", or does it really
matter because it will get swallowed up in the rules?

jeff

PS I wish the X paste feature to the gprolog
interpreter would show all the code.  It's probably a
readline problem.  It only happens with 5 or more
lines of code...

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com



reply via email to

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