Re: [eclipse-clp-users] delayed goals

From: Joachim Schimpf <joachim.schimpf_at_...269...>
Date: Thu, 13 Jan 2011 10:39:01 +1100
Sonia Estevez wrote:
> Hi.
> 
> We want to get the list of delayed goals in a readable format and we
> are using subcall or delayed_goals predicates. However, the
> information we get from these predicates is much harder to read for a
> user than the delayed goals info shown on the screen by eclipse. For
> example
> 
> [eclipse 4]: [X,Y,Z]::1..4, X#<Y,Y#<Z, delayed_goals(T).
> 
> X = X{[1, 2]}
> Y = Y{[2, 3]}
> Z = Z{[3, 4]}
> T = [prop_ic_con(ic_con("\005\000\000\000\002\000\000\000\000\000\000\000\000\00
> 0\000\200\000\000\000\000\000\000\000\000\a\000\000\000\023\000\000\000\000\000\
> 000\000\000\000\360\177 \034\020\020\375s\031", 1, "\000\000\000\000\000\000\360
> ?\000\000\000\000\000\000\360", "\000\000\000\000\000\000\360?\000\000\000\000\0
> 00\000\360", [](Y{[2, 3]}, X{[1, 2]}), 'SUSP-_869-susp')), prop_ic_con(ic_con("\
> 005\000\000\000\002\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\
> 000\000\000\000\000\033\020\020\377\000\000\200\017\000\000\000\023\000\000\000\
> 000\000\000\000\000\000\360", 1, "\000\000\000\000\000\000\360?\000\000\000\000\
> 000\000\360", "\000\000\000\000\000\000\360?\000\000\000\000\000\000\360", [](Z{
> [3, 4]}, Y), 'SUSP-_931-susp'))]
> 
> Delayed goals:
>         Y{[2, 3]} - X{[1, 2]} #> 0
>         Z{[3, 4]} - Y{[2, 3]} #> 0
> Yes (0.00s cpu)
> 
> 
> Is there a predicate to obtain the delayed goals in the same format as
> printed on the screen ( Y{[2, 3]} - X{[1, 2]} #> 0, Z{[3, 4]} - Y{[2,
> 3]} #> 0 ) ?

Yes, use portray_term/3:

?- [X,Y,Z]::1..4, X#<Y,Y#<Z, delayed_goals(Ts),
   (foreach(T,Ts),foreach(G,Gs) do portray_term(T,G,goal)).
...
Gs = [Y{[2, 3]} - X{[1, 2]} #> 0, Z{[3, 4]} - Y #> 0]
...
There are 2 delayed goals.
Yes (0.00s cpu)


-- Joachim
Received on Wed Jan 12 2011 - 23:39:17 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST