Re: [eclipse-clp-users] posting ic constraints does not terminate

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Wed, 14 Jan 2009 17:02:29 +1100
Joachim Schimpf wrote:
>...
> Here is more generic code for the same idea:
> 
> simplifiable(Constraint) :-
>        call(Constraint),       % post for the first time
>        suspend(repost_simplified(Constraint), 0, Constraint->bound).

Correction:
         suspend(repost_simplified(Constraint,Susp), 0, Constraint->bound, Susp).

> 
> :- demon repost_simplified/2.
> repost_simplified(Constraint, Susp) :-
>        call(Constraint),       % post again
>        ( ground(Constraint) -> kill_suspension(Susp) ; true ).
> 
> 
> This can be used as follows:
> 
> no_longer_infinite_loop :-
>        integers([V1,V2]),
>        V2 $>= 1,
>        simplifiable(V1 $> V2),
>        V1 $= V2.
> 
> 
> -- Joachim
Received on Wed Jan 14 2009 - 06:02:59 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST