Thank you for the answer. I have realised my stupid mistake a minute after sending a post to a group. By the way I would like to clarify another issue. Suppose I have a predicate: test. 1) test has arity 1: test(V) :- V is 1. Now using rpc: CompoundTerm ret = engine.rpc( new CompoundTermImpl( "test", null) ); does not work. I get a following exception com.parctechnologies.eclipse.CompoundTermImpl.<init>(CompoundTermImpl.java:68) 2) Having test defined as follows: test(V, N) :- V is 1. the following Java code works: CompoundTerm ret = engine.rpc( new CompoundTermImpl( "test", null, new Integer(3)) ); Why 1) throws an exception and 2) does not? I would like to have a predicate defining variable, that is of arity 1 ( like test(V) ). Best regards [ Wit Jakuczun w.jakuczun_at_wlogsolutions.com ] [ WLOG Solutions http://wlogsolutions.com ] 2008/5/27 Kish Shen <kish_at_crosscoreop.com>: > Hi, > > Wit Jakuczun wrote: >> >> Hi, >> I have a question regarding Java to ECLiPSe interface. >> I have a prolog program that consists of a few modules. >> I would like to be able to call a predicate from a module. >> For this I tried such code: >> CompoundTerm ret = engine.rpc( >> new CompoundTermImpl(":", >> "problem", >> "test(V)" >> ) >> ); >> >> Unfortunately it does not work. I get the following error: >> type error in type error in is_a_module("problem") >> >> > > You are using Java strings for "problem" and "test(V)". These are mapped to > ECLiPSe strings -- see the section on the mapping between ECLiPSe and Java > data types in the Embedding manual. ECLiPSe modules > have to be atoms, not strings -- this is why you are getting the type error > (and also "test(V)" is a string, and not > the compound term test(V)). > > Cheers, > > Kish > >> Of course earlier I have apriopriate >> engine.rpc("use_module(\"problem.ecl\")"); >> >> Moreover I can call a predicate from a module using C interface. >> >> I would be grateful for any explanation. >> >> Best regards >> -- >> [ Wit Jakuczun w.jakuczun_at_wlogsolutions.com ] >> [ WLOG Solutions http://wlogsolutions.com ] >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECLiPSe-CLP-Users_at_lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >> > >Received on Wed May 28 2008 - 00:04:51 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET