🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3104

Re: back_retract

#3104
From: Micha Meier
Date: Wed, 16 Mar 1988 15:30
42 lines
2144 bytes
In article <777@cresswell.quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>However, both versions of back_retract/1 have a rather more serious
>failure mode.
>
>Consider
>
>	back_retract(<clause>),
>	...
>	!,
>	...
>	fail
>
>By analogy with variable bindings, you would expect the back-retracted
>clause to reappear.  But the cut will have had the effect of pruning
>away the "assert".  Was it in 1983 or 1984 that I pointed this problem
>out in the Prolog Digest, with reference to an 'assume' operation?

	1983, but not really pointed out :-)
	This is only an implementation problem. If you, instead of
	using code to implement the backtrackable retract, push
	a suitable reference on the trail, then it works fine even
	with the cut, provided that you do not tidy up the trail
	(as described in the old engine). For some systems this might
	be too costly, as they use no special trail entries,
	but if the trail is already used to undo different things,
	that one is easily incorporated. You can get backtrackable
	assignment for free, then.

	Since several people here at ECRC asked me to provide
	backtrackable assert and retract, I assume that it can
	really be useful. One possible application is hypothetical
	reasoning - with the asserts and retracts you create
	alternative worlds, but you certainly want to be able to
	return to your universe. This is completely logical.
	Another area where it could be used is for database integrity
	constraints checking, or of course for
	theorem proving. Since all this stuff is logical,
	the above mentioned implementation can be used (there are
	no cuts), but sometimes it is desirable to have the old
	clause back at the position where it was before.

--Micha
Technical Details
Message-ID: <516@ecrcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!unido!ecrcvax!micha
References: <1194@kulcs.kulcs.uucp> <777@cresswell.quintus.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!unido!ecrcvax!micha
From: micha@ecrcvax.UUCP (Micha Meier)
Newsgroups: comp.lang.prolog
Subject: Re: back_retract
Message-ID: <516@ecrcvax.UUCP>
Date: 16 Mar 88 15:30:07 GMT
References: <1194@kulcs.kulcs.uucp> <777@cresswell.quintus.UUCP>
Reply-To: micha@ecrcvax.UUCP (Micha Meier)
Organization: ECRC, Munich 81, West Germany
Lines: 42