Re: Remove all asserted facts?
From: Paul Tarau (ptarau_at_yahoo.com)
Date: 08/26/04
- Next message: Bart Demoen: "Re: Remove all asserted facts?"
- Previous message: Stephan Lehmke: "Re: Godel's Incompleteness and Nonmonotonic Logic"
- In reply to: news.adelphia.net: "Remove all asserted facts?"
- Next in thread: Bart Demoen: "Re: Remove all asserted facts?"
- Reply: Bart Demoen: "Re: Remove all asserted facts?"
- Reply: Jan Wielemaker: "Re: Remove all asserted facts?"
- Reply: vannoord_at_let.rug.nl: "Re: Remove all asserted facts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Aug 2004 13:14:07 -0700
"news.adelphia.net" <no-mail-please@nospam.com> wrote in message news:<O4GdnY0PNb08MLHcRVn-oQ@adelphia.com>...
> I want to remove all facts that were instantiated by the assert() statement
> (I want to reset the Prolog database). I tried:
>
> retractall(_).
>
> But I got an instantiation error. What's the most convenient way to do
> this?
>
> Thanks.
In systems with multiple dynamic databases like BinProlog or Jinni
you can use operations like *db_clean(DataBaseName)* to achieve this
efficiently. In any case, using *abolish* is faster than *retractall*
which has to linearly scan all clauses - not a very smart thing given
that you want all of them removed! Having to keep track of your
asserted predicates is clearly no fun - you might want to use things
like *current_predicate* for doing this automatically - but again,
that
adds unpleasant complexity, performace hits and/or non-portability
to your code.
Paul Tarau
=============================================================
New Jinni3D Prolog toolkit with high-level agent oriented
API, supporting morphing, 3D-avatar animation, 3D-graph layout
and more - is now available from http://www.binnetcorp.com
=============================================================
- Next message: Bart Demoen: "Re: Remove all asserted facts?"
- Previous message: Stephan Lehmke: "Re: Godel's Incompleteness and Nonmonotonic Logic"
- In reply to: news.adelphia.net: "Remove all asserted facts?"
- Next in thread: Bart Demoen: "Re: Remove all asserted facts?"
- Reply: Bart Demoen: "Re: Remove all asserted facts?"
- Reply: Jan Wielemaker: "Re: Remove all asserted facts?"
- Reply: vannoord_at_let.rug.nl: "Re: Remove all asserted facts?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|