Article View: comp.lang.prolog
Article #1031Re: Novice RETRACT question
From: Marc Milgram
Date: Tue, 31 Jul 1990 17:02
Date: Tue, 31 Jul 1990 17:02
29 lines
1443 bytes
1443 bytes
In article <1939@engage.enet.dec.com>, ssmith@ncdel.enet.dec.com
(Sheldon E. Smith) writes:
|>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.
|>reduce_objects :- object(I,X,Y),object(J,X,Y),
|> I < J,
|> retract(object(I,X,Y)).
Alternately, you could do this at assert time with:
assert_unique_object(object(I, X, Y)):-
not(( retract(object(_, X, Y), fail)),
assert(object(I, X, Y)).
|>------------------------------------------------------------------------
|>---------
|>Sheldon E. Smith !Email:
|>Digital Equipment Corporation ! ssmith%ncdel.enet.dec@decwrl.dec.com
|>Minneapolis, Minnesota ! ...!decwrl!ncdel.enet.dec.com!ssmith
|>========================================================================
|>=========
Marc Milgram Email: milgr@teapot.prime.com
Prime Computer
Framingham, MA
Technical Details
Message-ID:
<728@primerd.PRIME.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!ucbvax!bloom-beacon!primerd!teapot!milgrReferences:
<1939@engage.enet.dec.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!ucbvax!bloom-beacon!primerd!teapot!milgr From: milgr@teapot.prime.COM (Marc Milgram) Newsgroups: comp.lang.prolog Subject: Re: Novice RETRACT question Message-ID: <728@primerd.PRIME.COM> Date: 31 Jul 90 17:02:48 GMT References: <1939@engage.enet.dec.com> Sender: news@primerd.PRIME.COM Reply-To: milgr@teapot.prime.COM (Marc Milgram) Lines: 29