🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3961

Re: Committed Choice

#3961
From: Fernando Pereira
Date: Tue, 21 Mar 1989 02:41
23 lines
1564 bytes
In Edinburgh-family Prolog systems, the scope of a cut is the whole
clause in which it appears, even it the cut is inside a conditional.
This is a very useful control behavior, messy to simulate with cuts
that stay inside the scope of conditionals. For example, the following
is a common way of terminating a repeat/fail loop:

	...
	repeat,
		...
		( <exit condition> -> !
		; <continue condition> -> fail ).

I will agree with anybody that this is not a pristine example of
declarative programming, but such things *are* needed in the imperfect
logic-programming languages we have today. I also appreciate that we
could move the cut to after the conditional with the same result, but
there are more complicated situations, which I don't have the time now
to discuss, in which that alternative is not available.

Fernando Pereira
AI Center
SRI International
pereira@ai.sri.com
Technical Details
Message-ID: <8209@russell.STANFORD.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!labrea!russell!pereira
References: <11500012@hpldola.HP.COM> <733@gould.doc.ic.ac.uk> <1305@murtoa.cs.mu.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!labrea!russell!pereira
From: pereira@russell.STANFORD.EDU (Fernando Pereira)
Newsgroups: comp.lang.prolog
Subject: Re: Committed Choice
Summary: Cut should cut from inside conditionals
Keywords: cut if-then-else
Message-ID: <8209@russell.STANFORD.EDU>
Date: 21 Mar 89 02:41:44 GMT
References: <11500012@hpldola.HP.COM> <733@gould.doc.ic.ac.uk> <1305@murtoa.cs.mu.oz.au>
Sender: pereira@russell.Stanford.EDU (Fernando Pereira)
Reply-To: pereira@russell.UUCP (Fernando Pereira)
Organization: Center for the Study of Language and Information, Stanford U.
Lines: 23