How to clean the previous data
: Dear friends:
: I am really a new hand about PROLOG. Could you give me some advice about my
: I use 'assert' to insert some data into database, but when I start another
: running on program, I find the previous data still in the database which I
: really do not want them, even though I exit current program and reopen it
: again. I know I can put some 'retract' at the beginning of the program and
: clean the old data from database, but I have used a lots 'assert', so I have
: to put a lots 'retract' in the program, it is really too awkful. I wonder some
: experts on PROLOG can give an effect way to deal with this problem apart from
: Thanks a lot in advance for your help.
There are no doubt many solutions to this problem. The easiest is
to use abolish(Pred/Arity) - using retract may also run you into problems
if you leave choice-points after the last computation (ie untried branches)
as the logical-update-view of the database may restore certain parts of the
database to how they were when you first entered the predicate.
Most good Prologs will garbage collect the rest of the data at
little penalty - certainly less than restarting the interpreter.
IF/Prolog certainly supports this and other ISO predicates (and
Edinburgh syntax) and is available on all UNIX, MS-Windows etc
Prolog Hotline Support,
marketing: Annette Kolb
technical: Dr. Andrew R. Verden, IF Computer GmbH,
Tel: +49 89 7936 0037 D-82065 Baierbrunn,
Fax: +49 89 7936 0039 Germany.
World Wide Web: http://www.biz.isar.de/ifcomputer/