Search code examples
prologprolog-assert

SWI-Prolog - Fail to Assert


I define an operator as follows:

:- op(500, xfx, =>).

When I try something like:

assert(a => b).

Prolog raises an error that says 'No permission to modify static_procedure (=>)/2'.

Any solution?


Solution

  • As a security, you have to warn SWI that you are going to modify a predicate at runtime:

    :- dynamic (=>)/2.
    

    put at the top of the file should do it.