| Deutsch English Français Italiano |
|
<vj75ag$clr4$4@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Julio Di Egidio <julio@diegidio.name> Newsgroups: comp.lang.prolog Subject: Re: Can we do this with ancestral cuts or something? Date: Mon, 9 Dec 2024 17:19:28 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: <vj75ag$clr4$4@dont-email.me> References: <vj6rmq$clr4$1@dont-email.me> <vj6u0o$l219$1@solani.org> <vj73f8$clr4$2@dont-email.me> <vj752t$clr4$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 09 Dec 2024 17:19:28 +0100 (CET) Injection-Info: dont-email.me; posting-host="7790aa2e18bcf5e7788978594a704952"; logging-data="415588"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FQnskfKBYhPYbdQCVPc9qYC1H6vS7alo=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:/HamzBQFvxjGEOmT5jL9lkSb0k4= In-Reply-To: <vj752t$clr4$3@dont-email.me> Content-Language: en-GB Bytes: 2515 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