Using SWI-Prolog (threaded, 64 bits, version 8.3.25)
File: my_clpfd.pl
:- module(my_clpfd,
[
]).
:- use_module(library(clpfd)).
Example run with error.
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.25)
...
?- working_directory(_,'C:/Users/Eric/Documents/Projects/SWI-Prolog/XYZ').
true.
?- [my_clpfd].
true.
?- X in 1..2.
ERROR: Syntax error: Operator expected
ERROR: X
ERROR: ** here **
ERROR: in 1..2 .
?- current_module(clpfd).
true.
?- use_module(library(clpfd)).
true.
?- X in 1..2.
X in 1..2.
?- current_module(clpfd).
true.
I was expecting the use of the directive :- use_module(library(clpfd)).
in my_clpfd
to load the library clpfd
and work. Using current_module(clpfd)
to check shows that the module was loaded but when using X in 1..2.
the error is generated.
Out of curiosity I manually loaded the module in the top level, use_module(library(clpfd)).
and then tried X in 1..2.
again and it worked.
I am at a lost to why and if I did something wrong.
Also checked what happens if I don’t load my module my_clpfd
which responded as expected.
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.25)
...
?- current_module(clpfd).
false.
?- X in 1..2.
ERROR: Syntax error: Operator expected
ERROR: X
ERROR: ** here **
ERROR: in 1..2 .
?- use_module(library(clpfd)).
true.
?- current_module(clpfd).
true.
?- X in 1..2.
X in 1..2.
EDIT
I uninstalled SWI-Prolog and checked that the directory C:\Program Files\swipl
was removed and reinstalled SWI-Prolog and still same problem.