Cannot create a custom CLP(Z) constraint.
I want to create my own custom constraint, so first I copied the example from the documentation into its own file (with slight modification of the first two lines):
```prolog
:- use_module(library(clpz)).
:- multifile(clpz:run_propagator/2).
oneground(X, Y, Z) :-
clpz:make_propagator(oneground(X, Y, Z), Prop),
clpz:init_propagator(X, Prop),
clpz:init_propagator(Y, Prop),
clpz:trigger_once(Prop).
clpz:run_propagator(oneground(X, Y, Z), MState) :-
( integer(X) -> clpz:kill(MState), Z = 1
; integer(Y) -> clpz:kill(MState), Z = 1
; true
).
```
However, consulting this results in the following error:
```prolog
error(permission_error(modify,not_declared_multifile_or_discontiguous,clpz:run_propagator(2)),load/1).
```
After doing some research I was unable to find any information on how to solve this issue. Nor was I able to find any other examples save those in clpz.pl itself, or anyone who would even try. The only one I was able to find is https://stackoverflow.com/questions/39591888/clpfd-constraint-is-a-prime-number, which is for SWI-Prolog and suffers from the same problem on scryer.
I tried this on 0.10 release as well as master.
5 条评论