triska / clpfd

Constraint Logic Programming over Finite Domains
https://www.metalevel.at/prolog/clpfd
169 stars 11 forks source link

SWIPL ad SWISH: "ERROR: Syntax error: Operator expected" using #= #2

Open svanschalkwyk opened 9 months ago

svanschalkwyk commented 9 months ago
?- use_module(library(clpfd)).
true.

?- 4 #= 2*Y.
ERROR: Syntax error: Operator expected
ERROR: 4
ERROR: ** here **
ERROR:  #= 2*Y . 
?- 

SWI-Prolog (threaded, 64 bits, version 9.0.4)

lorenzwinkler1 commented 8 months ago

I just stumbled across the same issue. Apparently use_module is a directive and thus has to be put into a file.

What worked for me:

# FILE: imports.pl

:- use_module(library(clpfd)).

I don't know if you can import that

Then run swi-prolog.swipl imports.pl. Afterwards running 4 #= 2*Y. yields the expected Y=2.