bug-prolog
[Top][All Lists]
Advanced

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

order


From: Robert Jäschke
Subject: order
Date: Tue, 15 Nov 2011 22:11:46 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20111004 Icedove/3.0.11

Hello,

When I load the following prolog program:

works(L) :-
        L = [Z1, Z2],
        fd_domain(L, 10, 99),
        fd_prime(Z1),
        cross_sum(Z1, Z2),
        fd_labeling(L),
        is_square(Z2)
        .

broken(L) :-
        L = [Z1, Z2],
        fd_domain(L, 10, 99),
        fd_prime(Z1),
        cross_sum(Z1, Z2),
        is_square(Z2),
        fd_labeling(L)
        .


cross_sum(X, X) :- X #<# 10.
cross_sum(X, Y) :- X #># 9, Y1 #=# X rem 10, X1 #=# X // 10,
cross_sum(X1, Z), Y #=# Z + Y1.

is_square(1).
is_square(4).
is_square(9).
is_square(X) :- fd_domain(Y, 1, X), X #=# Y * Y.


I get an error when invoking broken(L):

| ?- broken(L).
uncaught exception: error(type_error(integer,_#2097948(10..18)),fd_domain/3)

while works(L) gives me results:

| ?- works(L).

L = [79,16] ? ;

L = [97,16] ?

yes


The only difference between the two methods is the order of
fd_labeling(L) and is_square(Z2). To the best of my knowledge the order
should not matter. Thus, I assume that I hit a bug. Can you confirm this?



Information about my environment:

> uname -a
Linux tp 2.6.32-5-amd64 #1 SMP Mon Oct 3 03:59:20 UTC 2011 x86_64 GNU/Linux
> gprolog --version
Prolog top-Level (GNU Prolog) 1.4.0



Best regards,
Robert



-- 
I really didn't foresee the Internet. But then, neither did the
computer industry. Not that that tells us very much of course -
the computer industry didn't even foresee that the century was
going to end.       --  Douglas Adams, introduction to h2g2.com



reply via email to

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