masdeval wrote: > The program below gives the following results: > > Code 1 : > post_goal (" assert( g(30) ) "); > post_goal (" compile_term( p(X):- g(X) ) "); > post_goal ( term( EC_functor("p",1), H ) ); > EC_resume(); => H will take 30, there are no choicepoints or delayed goals > > Code 2 : > post_goal (" assert( g(40) ) "); > post_goal (" compile_term( p(X):- g(X) ) "); > post_goal ( term( EC_functor("p",1), W ) ); > EC_resume(); => W will take 30 > post_goal(" fail "); > post_goal ( term( EC_functor("p",1), W ) ); > EC_resume(); => W will take 40 You are doing something that you would never dream of doing in another programming language: recompiling your predicate (procedure/function/method) each time you are about to call it! Just because it's easy to recompile in ECLiPSe doesn't mean it's a good idea or even efficient. Your system is going to have absolutely ridiculous performance (remember that compiling a piece of code takes orders of magnitude longer than executing it). Leave your code constant (and compile it only once), and pass all non-constant values via arguments or otherwise. Apart from that general point, you use a mixture of assert and compile for no obvious reason (assert creates dynamic predicates). -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc / mailto:J.Schimpf@imperial.ac.uk Imperial College London / http://www.icparc.ic.ac.uk/eclipseReceived on Fri Sep 03 13:39:46 2004
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:30 PM GMT GMT