[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

asserta and assertz do different things???

From: Thorsten Krebs
Subject: asserta and assertz do different things???
Date: Wed, 24 Oct 2001 16:28:00 +0200


I am new to PROLOG and want to use the GNU Prolog / C interface to
manage constraint solving from a C program. But since I don't know
Prolog well I have problems with it's semantics...

I try get a little test program running which is a databse of ancestors.
Entries a of the form "parent(bob, mary)." and the functions for queries
are "anc(X,Y):-parent(X,Y)." and "anc(X,Y):-parent(X,Y),anc(Y,Z)."

Now I use the assert directive to insert knowledge. No problem so far.
But when I try to delete knowledge with retract... like
"retract(parent(bob, mary))" I get different outputs from program wether
I used the asserta oder the assertz directive... (?)
Using assertz the only entry left in my database is the one I wanted to
be deleted and using asserta my program crashes...

What is the difference betrween these two assert's and does retract
really delete knowledge or something else...

I am really starting to feel weird about this...

Thanks if anyone has a hint for me!

Thorsten Krebs  mailto:address@hidden
Uni Bremen
FB3 Informatik

reply via email to

[Prev in Thread] Current Thread [Next in Thread]