home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / prolog / 1617 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.7 KB

  1. Path: sparky!uunet!mcsun!corton!geocub!billaud
  2. From: billaud@greco-prog.fr (Michel BILLAUD)
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: Help on problem needed!
  5. Keywords: help
  6. Message-ID: <1992Aug27.075431.5839@greco-prog.fr>
  7. Date: 27 Aug 92 07:54:31 GMT
  8. References: <meskes.713709771@ulysses> <1992Aug25.074623.25450@greco-prog.fr> <1992Aug26.130909.17909@neptune.inf.ethz.ch>
  9. Reply-To: billaud@geocub.UUCP (Michel BILLAUD)
  10. Organization: LaBRI - Universite Bordeaux I - France
  11. Lines: 32
  12.  
  13. In article <1992Aug26.130909.17909@neptune.inf.ethz.ch> marti@nugget.inf.ethz.ch (Robert Marti) writes:
  14. >In article <1992Aug25.074623.25450@greco-prog.fr>, billaud@greco-prog.fr
  15. >(Michel BILLAUD) writes:
  16. >|> In article <meskes.713709771@ulysses>
  17. >|> meskes@ulysses.informatik.rwth-aachen.de (Michael Meskes) writes:
  18. >|> 
  19. >|> > Can you program a IF...THEN...ELSE in Prolog without using the cut?
  20. >|> 
  21. >|> No. a proof by contradiction:
  22. >
  23. >[ proof deleted ]
  24. >
  25. >I am sorry to contradict your contradiction ;-)  As someone else has
  26. >pointed out, it _is_ possible to program if-then-else without cut
  27. >IN CERTAIN SPECIAL CASES.
  28.  
  29. Yes (I'm happy to agree :-)), it's possible in certain special cases *only*.
  30. The [deleted] result was about the impossibility to build a *general* 
  31. IF-THEN-ELSE construct from AND/OR/TRUE/FAIL, so where's the contradiction?
  32.  
  33. Also, it's possible to replace cut by if-then-else in a number of cases
  34. (clauses with no ";"), but not in *all* the cases. for example, try:
  35.     p(X) :-  g(X), ((r(X),!,fail);true).
  36.  
  37. Michel
  38.  
  39.  
  40. -- 
  41. Michel BILLAUD                 :  billaud@geocub.greco-prog.fr
  42. Departement d'Informatique     :  phone W: 56.84.57.92  // 56.84.69.22
  43. IUT "A", Universite Bordeaux I :  "Je veux jouer de l'helicon
  44. 33405 Talence  (FRANCE)        :        pon pon pon pon !    "
  45.