user502187
user502187

Reputation:

How can I freely assert/retract facts with modules in ECLiPSe Prolog?

I am trying to run the following test case:

test :- assertz(abc : uvw(1)).

The above works in SWI-Prolog. But I am having problems in making it work in ECLiPSe Prolog. I am getting the following error:

trying to redefine an existing imported procedure in assertz(abc : uvw(1))

I didn't import abc:uvw/1, neither does it exist. Any flags around that would allow to run test/0 successfully in ECLiPSe Prolog?

Best Regards

Edit: P.S.: The following phrasing does also not work:

test :- abc : assertz(uvw(1)).

One then only gets the following error message:

lookup module does not exist in abc : assertz(uvw(1)) in module eclipse

Upvotes: 2

Views: 316

Answers (1)

jschimpf
jschimpf

Reputation: 5034

ECLiPSe uses the @-annotation to specify the context module for a predicate:

test :- assertz(uvw(1)) @ abc.

See also http://www.eclipseclp.org/doc/bips/kernel/control/A-2.html

Upvotes: 3

Related Questions