🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1036

Re: Re: Novice RETRACT question (now SETOF/BAGOF question)

#1036
From: Sheldon E. Smith
Date: Wed, 01 Aug 1990 23:17
31 lines
2231 bytes
Thanks to all who've responded (both here and via E-mail).   Yes, it
occurred to me that evening (after posting) that I'd also need a
backtracking loop.  I checked the following morning, and, sure enough,
it *had* worked; I simply had too many facts to see that one was gone. 
BTW, I'm using the Edinburgh C-Prolog interpreter.
I have it running now.  FWIW, I have a *large number* of Object rules,
of which about 20% are obsolete.  It's taking about two hours of CPU
time on a 8820 to reduce.  Would the usage of SETOF/BAGOF be faster?

A couple of you mentioned the use of SETOF or BAGOF as an alternative
method of locating the redundant facts.  How can I put this: "That went
*way* over my head", or to summarize, "Huh??"  I'm still trying to
understand SETOF/BAGOF.  Perhaps I've had too many years of structured
(3rd generation) programming, or maybe it's just that I can be *dense*!   8^)
One proffered example (that I *almost* understand) was from Bart Demoen:
	reduce_objects :- bagof(object(I,X,Y), J^(object(I,X,Y), object(J,X,Y),
I<J), L),
			delete_objects_in_list(L).
	delete_objects_in_list([]).
	delete_objects_in_list([Obj|T]) :- retract(Obj), delete_objects_in_list(T).
I *do* understand what "delete_objects_in_list" is doing.   8^)
Would some *kind* soul translate/comment *profusely* the BAGOF call?

Thanks in advance,
------------------------------------------------------------------------
---------
Sheldon E. Smith			!Email:
Digital Equipment Corporation		! ssmith%ncdel.enet.dec@decwrl.dec.com
Minneapolis, Minnesota			! ...!decwrl!ncdel.enet.dec.com!ssmith
========================================================================
=========
Technical Details
Message-ID: <1947@engage.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!haven!decuac!shlump.nac.dec.com!engage.enet.dec.com!ncdel.enet.dec.com!ssmith

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!haven!decuac!shlump.nac.dec.com!engage.enet.dec.com!ncdel.enet.dec.com!ssmith
From: ssmith@ncdel.enet.dec.com (Sheldon E. Smith)
Newsgroups: comp.lang.prolog
Subject: Re: Re: Novice RETRACT question (now SETOF/BAGOF question)
Message-ID: <1947@engage.enet.dec.com>
Date: 1 Aug 90 23:17:13 GMT
Sender: news@engage.enet.dec.com
Reply-To: ssmith@ncdel.enet.dec.com (Sheldon E. Smith)
Organization: Digital Equipment Corporation
Lines: 31