Re: [eclipse-clp-users] Suspend till tentative value change

From: Edgaonkar, Shrirang <Shrirang.Edgaonkar_at_...390...>
Date: Thu, 4 Feb 2016 22:36:30 +0000
Dear Joachim,

Not sure if I need it, but can we 'wake' such a suspension without actually changing the tentative value?  It is similar to constrained(String) if the it is as String constrained.

Regards,
Shrirang 

> On 04-Feb-2016, at 9:51 PM, Joachim Schimpf <jschimpf_at_...311...> wrote:
> 
>> 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,
> Joachim
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users

______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.
Received on Thu Feb 04 2016 - 22:36:42 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST