variable analysis

Carlo Capelli <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CABty9wxYhL8OcAx44SAA6tBsXsUvUdfRXeY6gX3C-dxdPB=XhQ@mail.gmail.com>
After upgrading to latest version, I get some warning.

This come from CLP(FD) manual example code

n_factorial(0, 1).
n_factorial(N, F) :- N #> 0, N1 #= N - 1, F #= N * F1, n_factorial(N1, F1).

indeed is working:


2 ?- n_factorial(10,X).

X = 3628800


3 ?- n_factorial(Y,$X).

Y = 10


but I get

Warning: /home/carlo/prolog/coins.pl:180:

Test is always true: var(N1)

seems that the data flow should be relaxed here.

Also my code generates similar warnings

curious_fraction(Nr, Dr) :-
   Vs = [N1,N2, D1,D2], Vs ins 1..9,
   N #= N1 * 10 + N2, D #= D1 * 10 + D2, D #> N,
   select(C, [N1,N2], [Nr]), select(C, [D1,D2], [Dr]),
   N * Dr #= Nr * D, label(Vs).

generates

Warning: /home/carlo/prolog/coins.pl:129:

Test is always true: var(N)

Test is always true: var(D)

OT: Jan, the jump to source origin of message now make difficult to select
the text, I will try to fix it...

bye Carlo
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.