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?
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?
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.
(;)/2
and (',')/2
. The quotes serve only to delimit a token - like 'a b'
they are needed independently of operator declarations. –
Dioptase You must have meant another symbol in place of (=>)/2
. Probably (->)/2
which is a control construct that cannot be modified.
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 6.1.3-116-gf1c7e06) ... ?- asserta((a -> b)). ERROR: asserta/1: No permission to modify static procedure `(->)/2' ERROR: Defined at /opt/gupu/pl-devel/lib/swipl-6.1.3/boot/init.pl:194 ?- op(500, xfx, =>). true. ?- asserta(a => b). true.
© 2022 - 2024 — McMap. All rights reserved.
(=>)/2
– Dioptase