On 04/02/16 02:01, Edgaonkar, Shrirang wrote: > Dear clp users, > > I wish to suspend a predicate till a change in tentative value occurs to one > of its variables. I get the following error "out of range in suspend(cast(_612, > _613), 1, _613 -> tent_chg, 'SUSP-5-susp') in module eclipse" > > for the following script > > :- lib(tentative). > solve(R):- > cast(Number,String), > tent_set(String, 1). > > > cast(Number,String):- > (var(String)-> > suspend(cast(Number,String), > 1, String->tent_chg, Susp2);writeln(instantiated),true). > > Whenever tentative value of String changes it should invoke cast(Number,String) > is the intention. Two issues here: 1. write String->tentative:tent_chg instead of just String->tent_chg (this is wrong in the manual, sorry) 2. you can only suspend on the tent_chg condition when the variable already has a tentative value. So you have to call tent_set/2 before. And a third recommendation: don't use 1 as the suspension priority (it is the highest priority, and reserved for debugging purposes). Use 0 for default, or 2 and higher. Cheers, JoachimReceived on Thu Feb 04 2016 - 12:50:49 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST