Hi On Tue, Apr 13, 2004 at 09:36:31AM -0300, cbraz@alanet.com.br wrote: > I'am trying to create a predicate p(X) :- X is 10 doing the following > > EC_ref X; > post_goal(term(EC_functor(":-",2), term(EC_functor("p",1),X), > term(EC_functor("is",2), X, 10))); > but when i run the program the error "Calling an undefined procedure > error p(X) :- X is 10" in module eclipse occur. If you `post' the goal to ECLiPSe from within the top-level interpreter you will see the problem: [eclipse 1]: p(X) :- X is 10. calling an undefined procedure p(X) :- X is 10 in module eclipse Abort The post_goal predicate is used to post goals for execution. You are however attempting to post the definition of a predicate as a statement for execution not for compilation! Within the interpreter you would execute: [eclipse 2]: [user]. p(X) :- X is 10. user compiled traceable 28 bytes in 0.00 seconds Yes (0.00s cpu) [eclipse 3]: p(X). X = 10 Yes (0.00s cpu) The same applies from your external C++ code. You must construct the term as you have done _and_ compile it. In order to do this you must construct the term wrapped in the compile_term/1 predicate: [eclipse 1]: compile_term(p(X) :- X is 10). X = X Yes (0.00s cpu) [eclipse 2]: p(X). X = 10 Yes (0.00s cpu) As a side note, if you construct an ECLiPSe module from external code, don't forget to export/1 the predicate. Hope that helps. AndyReceived on Tue Apr 13 15:47:57 2004
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:28 PM GMT GMT