🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2638

Re: Control Structures

#2638
From: Bjorn Danielsson
Date: Wed, 08 Apr 1987 06:01
19 lines
1286 bytes
In article <276@ecrcvax.UUCP> mcvax!unido!ecrcvax!micha (Micha Meier) writes:
>From the efficiency point of view, a solution with nonstandard cuts
>(see Lee's note) is the best one, ...

I suggest a somewhat simpler (and less general) syntax for delayed cuts:

delayed_cut(Goal) should work just like ordinary cut, except that the
actual cutting is delayed until Goal has succeeded.

P :- A,!,B.             would be the same as    P :- A,delayed_cut(true),B.
P :- A,soft_cut,B.      would be the same as    P :- delayed_cut(A),B.

The solutions to Francois-Michel Lang's problems would be:

xor(A,B) :- delayed_cut(A) ; B.
P :- A, delayed_cut(B), C, D.           % Assuming P has no more clauses.

-- 
Bjorn Danielsson, ZYX, +46 8 653205, ...mcvax!enea!zyx!bd
Technical Details
Message-ID: <411@zyx.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!enea!zyx!bd
References: <bigburd.2285> <276@ecrcvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!enea!zyx!bd
From: bd@zyx.UUCP (Bjorn Danielsson)
Newsgroups: comp.lang.prolog
Subject: Re: Control Structures
Message-ID: <411@zyx.UUCP>
Date: Wed, 8-Apr-87 01:01:40 EST
Article-I.D.: zyx.411
Posted: Wed Apr  8 01:01:40 1987
Date-Received: Mon, 13-Apr-87 03:45:06 EST
References: <bigburd.2285> <276@ecrcvax.UUCP>
Reply-To: bd@zyx.UUCP (Bjorn Danielsson)
Organization: ZYX Sweden AB, Stockholm
Lines: 19