Article View: comp.lang.prolog
Article #3977Re: Committed Choice
From: Richard Okeefe
Date: Thu, 30 Mar 1989 06:05
Date: Thu, 30 Mar 1989 06:05
24 lines
1439 bytes
1439 bytes
: In article <8209@russell.STANFORD.EDU> pereira@russell.UUCP (Fernando Pereira) writes:
: : repeat,
: : { Body }
: : ( <exit condition> -> !
: : ; <continue condition> -> fail
: : ).
In article <18798@adm.BRL.MIL>, broome@adm.BRL.MIL (Paul Broome ) writes:
: Here's one alternative I've seen that's only slightly cleaner: Define
: repeat(Body, Until) :-
: repeat,
: Body,
: Until,
: !.
: Then we can accomplish the same thing with
: ...
: repeat(<continue condition>, <exit condition>).
They don't do the same thing. When we're talking about cuts and repeats,
we're in Imperative land. Consider then that the first version calls the
body then the exit condition and then the continuation condition. While
the second version is missing the body and calls the continuation
condition before the exit condition. (Actually, the second version has
mixed the body and continuation condition up.)
Technical Details
Message-ID:
<192@aucsv.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-lcc!lll-winken!uunet!munnari!vuwcomp!dsiramd!marcamd!aucsv!okReferences:
<11500012@hpldola.HP.COM> <733@gould.doc.ic.ac.uk> <18798@adm.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-lcc!lll-winken!uunet!munnari!vuwcomp!dsiramd!marcamd!aucsv!ok From: ok@aucsv.UUCP (Richard Okeefe) Newsgroups: comp.lang.prolog Subject: Re: Committed Choice Summary: not identical Keywords: cut if-then-else Message-ID: <192@aucsv.UUCP> Date: 30 Mar 89 06:05:54 GMT References: <11500012@hpldola.HP.COM> <733@gould.doc.ic.ac.uk> <18798@adm.BRL.MIL> Organization: Computer Science Dept.,University of Auckland,New Zealand Lines: 24