users-prolog
[Top][All Lists]
Advanced

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

Re: Questions about Answers


From: Jean Michel LECONTE
Subject: Re: Questions about Answers
Date: Sat, 20 Oct 2001 12:26:56 +0200

i tried your program and i think that in the case where you ask 
adjacent(1,X). it detects automatically that there isn't anymore choice point 
and dont ask you if you want another solution and reply yes

in the case where you ask adjacent(X,1). it doesnt detect it and it lets you 
ask for another solution and replies no ...

| ?- adjacent(1,X).
 
X = 2 ?
 
X = 3 ?
 
X = 4 ? 
 
X = 5  % it detects its there is no more choice point and doesnt ask you if 
you want another solution ...
 
yes              


Jean Michel LECONTE
Jeff Pitman wrote  :
> 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
>
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/users-prolog



reply via email to

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