🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1029

Novice RETRACT question

#1029
From: Sheldon E. Smith
Date: Tue, 31 Jul 1990 00:04
32 lines
1800 bytes
Hello.  I'm teaching myself Prolog (Why? Because I *want* to.   8^}   ) 
I'm playing with a program that generates a *load* of facts.  Many of
the facts are "time-stamped", so quite a few facts are duplicate or obsolete. 

While I have the _Clocksin & Mellish, 2nd ed._ book, I haven't found a
*really good* tutorial.  What I'd *really* like is a book of Prolog
algorithms, but I'll defer *that* to another article.

In any event, I have facts of the form
	object(Time,X,Y)
where X and Y are locations, and Time is the time-stamp when the object
was observed.  That is, given the facts
	object(1,12,34).
	object(2,12,34).
	object(3,12,34).
I'd like to retract "object(1,12,34)" and "object(2,12,34)".

I'd have thought that something like
reduce_objects :- object(I,X,Y),object(J,X,Y),
		I < J,
		retract(object(I,X,Y)).

What am I doing wrong?  Am I even on the right track?

Thanks in advance for any help,
------------------------------------------------------------------------
---------
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: <1939@engage.enet.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!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!umich!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!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: Novice RETRACT question
Message-ID: <1939@engage.enet.dec.com>
Date: 31 Jul 90 00:04:41 GMT
Sender: news@engage.enet.dec.com
Reply-To: ssmith@ncdel.enet.dec.com (Sheldon E. Smith)
Organization: Digital Equipment Corporation
Lines: 32