Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!icdoc!cdsm From: cdsm@doc.ic.ac.uk (Chris Moss) Newsgroups: comp.lang.prolog Subject: Re: Committed Choice Message-ID: <733@gould.doc.ic.ac.uk> Date: 14 Mar 89 14:26:04 GMT References: <11500012@hpldola.HP.COM> Reply-To: cdsm@doc.ic.ac.uk (Chris Moss) Organization: Dept. of Computing, Imperial College, London, UK. Lines: 34 In article <11500012@hpldola.HP.COM> patch@hpldola.HP.COM (Pat Chkoreff) writes: >It seems to me that the if-then-else construct in Prolog completely >eliminates the need for the cut, and is a far superior mechanism for >enforcing committed choice. Am I right? There are 2 reasons for choice of control structures in Prolog: efficiency and clarity. Certainly from a theoretical point of view (the "power" of the system) if then-else is adequate, but there are lots of reasons why it's given problems. See for instance the appendix in Ehud Shapiro's book "Algorithmic Program debugging" which uses conditionals far more than his later book "Art of Prolog". (He had an argument with David Warren and lost!). (Art of Prolog has very few cuts too). Richard O'Keefe put a powerful counterargument in his "Treatment of Cuts in Prolog Source-Level tools" paper in IEE Symposium on LP, 1985. But even he advocates cuts in some places on stylistic and efficiency grounds. >Books on Prolog tend to emphasize the nuances of using the cut, but >rarely discuss if-then-else. Is this due to historical reasons? Well for one thing there are different variations even of if-then-else! For example, does an if-then without an else fail or succeed. It appears that the Europeans on the standardization committee think it should succeed: in "Edinburgh" systems it fails. If we were to start Prolog again, I'd back Gert Smolka's proposals in "Making Control and Data Flow in Logic Programs Explicit" in the 1984 ACM Functional Programming Conference. But of course we aren't going to! Chris Moss.