🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4234

Re: Legitimate uses of "assert"?

#4234
From: Dan Brahme
Date: Thu, 01 Mar 1990 15:38
35 lines
1500 bytes
mmh@cs.qmw.ac.uk (Matthew Huntbach) writes:

>"assert" and "retract" are best used to get round what I
>believe is a very awkward problem with Prolog, the fact that
>computations on the OR-branches of search trees cannot
>otherwise communicate.

>e.g

>pred(<args1>) :- body1
>pred(<args2>) :- body2

>Suppose body1 fails, but some of the partial calculations done
>within it are useful in body2. Then you have to use "assert"
>to pass them on.

>I still don't think this is in good taste. I would prefer
>something like:

>pred(<args>) :- body1',body2'.

>where body1' passes on any information required to body2' and
>has a flag which if set to "true" causes body2' to immediately
>halt.

>Matthew Huntbach

I think you can avoid the use of assert in the
situation you mentioned. There are ; and -> clauses
introduced in several prologs (quintus has them definitely),
which precisely serve this purpose.

Dan brahme
Texas Instruments
Technical Details
Message-ID: <112803@ti-csl.csc.ti.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!rice!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!apple!sun-barr!newstop!texsun!smunews!ti-csl!vlsic2!brahme
References: <8205@pt.cs.cmu.edu> <1708@sequent.cs.qmw.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!rice!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!apple!sun-barr!newstop!texsun!smunews!ti-csl!vlsic2!brahme
From: brahme@vlsic2.ti.com (Dan Brahme)
Newsgroups: comp.lang.prolog
Subject: Re: Legitimate uses of "assert"?
Message-ID: <112803@ti-csl.csc.ti.com>
Date: 1 Mar 90 15:38:32 GMT
References: <8205@pt.cs.cmu.edu> <1708@sequent.cs.qmw.ac.uk>
Sender: news@ti-csl.csc.ti.com
Organization: Texas Instruments Inc, SPDC Operations, Dallas, TX
Lines: 35