Discussion:
How to Define ins/2
Jan Burse
2013-09-18 22:26:20 UTC
Permalink
Dear All,

I am consulting a Prolog text with:

:- use_package(clpfd).

:- op(700, xfx, ins).
[] ins R.
[X|Y] ins R :- X in R, Y ins R.

But it doesn't work as expected:

?- [X,Y] ins 9..10, label([X,Y]).
no

Possible to make it work?

Bye
r***@clip.dia.fi.upm.es
2013-09-19 09:36:45 UTC
Permalink
Dear Jan,

It is clearly a bug. We corrected it in our internal repository.
A new development version included the patch will be available very soon.

Regards,

Remy
Post by Jan Burse
Dear All,
:- use_package(clpfd).
:- op(700, xfx, ins).
[] ins R.
[X|Y] ins R :- X in R, Y ins R.
?- [X,Y] ins 9..10, label([X,Y]).
no
Possible to make it work?
Bye
_______________________________________________
Ciao-users mailing list
http://clip.dia.fi.upm.es/cgi-bin/mailman/listinfo/ciao-users
Jan Burse
2013-09-19 10:06:37 UTC
Permalink
Hi,

Ok, got it working with:

:- use_package(clpfd).

:- op(700, xfx, ins).
[] ins R.
[X|Y] ins R :- clpfd_rt:(X in R), Y ins R.

I now have:

?- [X,Y] ins 9..10, label([X,Y]).

X = 9,
Y = 9 ? ;

Etc..

Great!

Bye
Post by r***@clip.dia.fi.upm.es
Dear Jan,
The module fd_term is exported by the package clpfd but should not. Then
the predicate in/2 from fd_term conflicts with the one of clpfd_rt.
To correct the bug, just comment the following line (line 41) in
ciao/contrib/clpfd/clpfd.pl
:- use_module(library(clpfd(fd_term))).
You can also work around by explicitly qualify the in/2 predicate.
[] ins R.
[X|Y] ins R :- clpfd_rt:in(X, R), Y ins R.
?- use_package(clpfd).
yes
?- [X,Y] ins 9..10, label([X,Y]).
X = 9,
Y = 9 ?
yes
Regards,
Remy
Post by Jan Burse
Dear All,
:- use_package(clpfd).
:- op(700, xfx, ins).
[] ins R.
[X|Y] ins R :- X in R, Y ins R.
?- [X,Y] ins 9..10, label([X,Y]).
no
Possible to make it work?
Bye
_______________________________________________
Ciao-users mailing list
http://clip.dia.fi.upm.es/cgi-bin/mailman/listinfo/ciao-users
Loading...