I try to define operator in a file using op/3
. Like so
is_in(Thing, Place):-
location(Thing, Place).
op(35, xfx, is_in).
But when I consult/1
file in repl, I get an exception
No permission to modify static procedure `op/3'
I tried to use dynamic
directive, but it results in the same error.
Executing op(35, xfx, is_in).
in repl works.
The problem is that you are trying to redefine op/3
predicate instead of declaring a new operator.
To declare a new operator when consulting a file you have to add a directive in your program:
:-op(35, xfx, is_in).
Note that the operator will not be available before the directive, so you should add the directive above its usage within the file.