Re: Floyd warshall
- From: bart demoen <bmd@xxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 22:25:28 +0200
On Fri, 31 Aug 2007 02:44:29 -0700, andrea wrote:
On 31 Ago, 09:17, Bart Demoen <b...@xxxxxxxxxxxxxxxxx> wrote:
andrea wrote:
I tried with a very small example
prova(X,Y) :-
dist(X,Y,Z), Z > 2 ->
write('maggiore'); write('minore'),write(Z).
?- prova(0,1).
minore_L136
So in the "else branch" Z is not unified anymore, why?? I dont' find a
suitable explanation..
How can I translate this little piece of code?
Suppose you had written (sorry for my indentation, I hope it is still readable to you)
f(X) :-
(test(X) ->
true
;
write(X)
).
test(foo) :- fail.
What value would you like to see on the output ?
Cheers
Bart Demoen
In this case nothing, but my test is not true, so it should enter in
the else branch, am I missing something??
Yes. You missed that my test is not true either. So, once more,
what do you want to be output in my f/1 ?
Cheers
Bart Demoen
.
- References:
- Re: Floyd warshall
- From: andrea
- Re: Floyd warshall
- From: andrea
- Re: Floyd warshall
- From: andrea
- Re: Floyd warshall
- From: andrea
- Re: Floyd warshall
- From: Bart Demoen
- Re: Floyd warshall
- From: andrea
- Re: Floyd warshall
- Prev by Date: Re: Floyd warshall
- Next by Date: Re: Floyd warshall
- Previous by thread: Re: Floyd warshall
- Next by thread: memory management in swi prolog
- Index(es):
Relevant Pages
|
Loading