Some of my Prolog programs could profit quite a bit if I could replace all (is)/2
-based integer arithmetics by their clpfd counterpart.
So I want the power ... with clpfd ... so I can replace X is 10^3
with something clpfd-y :)
Consider the following five Prolog processors supporting clpfd:
GNU Prolog 1.4.4
?- X #= 10^3. uncaught exception: error(type_error(fd_evaluable,(^)/2),(#=)/2) ?- X #= 10**3. X = 1000.
SWI-Prolog 7.3.14
?- use_module(library(clpfd)). % autoload would be even more awesome true. ?- X #= 10^3. X = 1000. ?- X #= 10**3. ERROR: Domain error: `clpfd_expression' expected, found `10**3'
B-Prolog 8.1
?- X #= 10^3. X #= 10^3. *** error(illegal_array_access,10^3) ?- X #= 10**3. X = 1000.
SICStus Prolog 4.3.2
?- use_module(library(clpfd)). true. ?- X #= 10^3. ! Existence error in (^)/2 ! constraint user:wi(^)/2 does not exist ! goal: 10^3 ?- X #= 10**3. ! Existence error in user:(**)/2 ! constraint user:(**)/2 does not exist ! goal: 10**3
Ideas / hints / advice, please. What can I do? Use some clpfd compatibility layer(s), perhaps?
Thank you in advance!