Reputation: 768
I've started to learn Prolog and I follow the RIPTutorial PDF. At the Constraint Logic Programming CLP(Q) section, it says:
Constraint Logic Programming CLP(Q) implements reasoning over rational numbers
Example:
?- { 5/6 = X/2 + 1/3 }.
X = 1.
When I've tried this line on SWI-Prolog on Windows, it gave:
ERROR: Unknown procedure: {}/1 (DWIM could not correct goal)
The same line on commandline SWI-Prolog-7.2.0 on macOS gives:
ERROR: toplevel: Undefined procedure: {}/1 (DWIM could not correct goal)
How to get the expected output of X = 1.
?
Upvotes: 1
Views: 420
Reputation: 24986
Using SWI-Prolog.
As noted in the comments you need to load the code for CLP(Q) first.
?- use_module(library(clpq)).
true
Then enter the query as in the example.
?- {5/6 = X/2 + 1/3}.
X = 1.
Upvotes: 3