2
votes

I am trying to write the following formula into swi prolog but get an error,

Here is the code/query I am typing

[X, Y, Z] ins 0 .. 4, X #= Y + 1.

and here is the error I am getting

ERROR: Syntax error: Operator expected
ERROR: [X, Y, Z]
ERROR: ** here **
ERROR:  ins 0..4, X #= Y + 1 . 

Could someone let me know what I did wrong.

1
?- [library(clpfd)]. - CapelliC
@CapelliC yes that was it, thanks it fixed it ] - user6248190

1 Answers

2
votes

The problem was that I forgot to import the library [library(clpfd)] so basically had to use the following statement use_module(library(clpfd)). This was spotted by @CapelliC