🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #740

Re: Help on problem needed!

#740
From: Michel BILLAUD
Date: Thu, 27 Aug 1992 07:54
32 lines
1829 bytes
In article <1992Aug26.130909.17909@neptune.inf.ethz.ch> marti@nugget.inf.ethz.ch (Robert Marti) writes:
>In article <1992Aug25.074623.25450@greco-prog.fr>, billaud@greco-prog.fr
>(Michel BILLAUD) writes:
>|> In article <meskes.713709771@ulysses>
>|> meskes@ulysses.informatik.rwth-aachen.de (Michael Meskes) writes:
>|> 
>|> > Can you program a IF...THEN...ELSE in Prolog without using the cut?
>|> 
>|> No. a proof by contradiction:
>
>[ proof deleted ]
>
>I am sorry to contradict your contradiction ;-)  As someone else has
>pointed out, it _is_ possible to program if-then-else without cut
>IN CERTAIN SPECIAL CASES.

Yes (I'm happy to agree :-)), it's possible in certain special cases *only*.
The [deleted] result was about the impossibility to build a *general* 
IF-THEN-ELSE construct from AND/OR/TRUE/FAIL, so where's the contradiction?

Also, it's possible to replace cut by if-then-else in a number of cases
(clauses with no ";"), but not in *all* the cases. for example, try:
	p(X) :-  g(X), ((r(X),!,fail);true).

Michel


-- 
Michel BILLAUD                 :  billaud@geocub.greco-prog.fr
Departement d'Informatique     :  phone W: 56.84.57.92  // 56.84.69.22
IUT "A", Universite Bordeaux I :  "Je veux jouer de l'helicon
33405 Talence  (FRANCE)        :        pon pon pon pon !    "
Technical Details
Message-ID: <1992Aug27.075431.5839@greco-prog.fr>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!geocub!billaud
References: <meskes.713709771@ulysses> <1992Aug25.074623.25450@greco-prog.fr> <1992Aug26.130909.17909@neptune.inf.ethz.ch>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!geocub!billaud
From: billaud@greco-prog.fr (Michel BILLAUD)
Newsgroups: comp.lang.prolog
Subject: Re: Help on problem needed!
Keywords: help
Message-ID: <1992Aug27.075431.5839@greco-prog.fr>
Date: 27 Aug 92 07:54:31 GMT
References: <meskes.713709771@ulysses> <1992Aug25.074623.25450@greco-prog.fr> <1992Aug26.130909.17909@neptune.inf.ethz.ch>
Reply-To: billaud@geocub.UUCP (Michel BILLAUD)
Organization: LaBRI - Universite Bordeaux I - France
Lines: 32