Re: Can we do this with ancestral cuts or something?

Liste des GroupesRevenir à cl prolog 
Sujet : Re: Can we do this with ancestral cuts or something?
De : julio (at) *nospam* diegidio.name (Julio Di Egidio)
Groupes : comp.lang.prolog
Date : 09. Dec 2024, 17:19:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vj75ag$clr4$4@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 09/12/2024 17:15, Julio Di Egidio wrote:
On 09/12/2024 16:47, Julio Di Egidio wrote:
On 09/12/2024 15:14, Mild Shock wrote:
Julio Di Egidio schrieb:
>
Given a list of goals representing a conjunction, I would like it to fail as soon as any goal fails, but I would like *not* to cut on the search space otherwise.
>
Here is my actual test case, only considering ground goals (otherwise too many ways to play with it that seem immaterial to the problem):
>
First create a conjunction:
    A1,...,An
Wrap each goal Aj into a soft cut:
   (Aj *-> true; !).
The cut will abort all previous goals.
>
Indeed soft-cuts do it, thank you very much!
>
Though with this scheme: `(Aj *-> true; !, fail)`.
>
I have also managed to abstract the recursive scheme away to a meta-predicate, by combining soft with ancestral cuts.  But I am not sure how good it is, especially since term rewriting also can do the trick and quite more simply so...
 Actually, this one works (no need for a soft cut in `scut`), and it at least starts making sense:
 ```
scut(G, ChF) :-
     (    call(G, ChF), !
     ;    prolog_cut_to(ChF),
         fail
     ).
```
No no, forget that: that is cutting on the search space.  The previous solution is it.
-Julio

Date Sujet#  Auteur
9 Dec 24 * Can we do this with ancestral cuts or something?11Julio Di Egidio
9 Dec 24 `* Re: Can we do this with ancestral cuts or something?10Mild Shock
9 Dec 24  +* '$MARK' and '$CUT' (Was: Can we do this with ancestral cuts or something?)2Mild Shock
9 Dec 24  i`- Re: '$MARK' and '$CUT' (Was: Can we do this with ancestral cuts or something?)1Julio Di Egidio
9 Dec 24  `* Re: Can we do this with ancestral cuts or something?7Julio Di Egidio
9 Dec 24   +* Re: Can we do this with ancestral cuts or something?2Julio Di Egidio
9 Dec 24   i`- Re: Can we do this with ancestral cuts or something?1Julio Di Egidio
9 Dec 24   `* Re: Can we do this with ancestral cuts or something?4Julio Di Egidio
9 Dec 24    `* A Timeless Confluence [Term Rewriting] (Was: Can we do this with ancestral cuts or something?)3Mild Shock
9 Dec 24     `* Re: A Timeless Confluence [Term Rewriting] (Was: Can we do this with ancestral cuts or something?)2Mild Shock
9 Dec 24      `- Re: A Timeless Confluence [Term Rewriting] (Was: Can we do this with ancestral cuts or something?)1Mild Shock

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal