2

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

1 Answers1

3

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

jschimpf
  • 4,904
  • 11
  • 24
  • I cannot use @ if I use module/3 with [swi]. I get `syntax error: postfix/infix operator expected` when I use the syntax operator. –  Mar 31 '14 at 16:52
  • I have a suspicion that you want to do some kind of benchmarking, in which case you should not use any compatibility layers as they could distort the result. – jschimpf Mar 31 '14 at 22:26
  • Yes exactly, since I want to go single source. See also http://stackoverflow.com/questions/22592791/is-there-a-way-to-use-module-2-in-eclipse-prolog . I thought macros are applied at compile time, so shouldn't cause some distortion. But maybe, who knows...? –  Apr 01 '14 at 10:09