users-prolog
[Top][All Lists]
Advanced

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

Re: Questions about Answers


From: Jeff Pitman
Subject: Re: Questions about Answers
Date: Sat, 20 Oct 2001 05:25:30 -0700 (PDT)

How would you propose to harness a function with a
return value based on choice points be determistic in
its output?

For example, say I represent a map with the below
adjacent/2 function.  This map is dynamic.  Maybe
similar to Fog-of-war where as the Agent explores the
map changes.

Then say I defined clauses that were dependent on the
outcome of generating an entire list of adjacent nodes
the Agent has explored.  

Would the "guess"ing of Prolog affect the outcome of
rules given the map size?  Or, is this an interpreter
output that has no effect on clauses?

I've also noticed while "trace"ing different queries
that the behavior of gprolog looping through ports of
each goal is not the same as other Prologs.  Is this
the result of optimization?

I'm still baffled at the:  true?  question, isn't
'yes' sufficient?

Will these different behaviors change the output of
clauses?

Thanks for your help,
jeff

--- Jean Michel LECONTE
<address@hidden> wrote:
> 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



reply via email to

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