Hi all,
I'm a little stuck with Q3 of Ass3. The point of the exercise is to use assertz and retract to store/remove the paths. Using assertz is fine, and all the required paths are happy added to the database. Using retract is a huge problemo at the moment, since I can't get Amzi/Prolog to retract the path just expanded.
If I use the following statement:
initial_state(X),
assertz(path([X])).
I have no problems. Unfortunately, the opposite doesn't work:
path(X),
retract(path(X)).
On the other hand, if I explicitly say
retract(path([whatever])).
it works! Obviously I can't explicitly program all my retract statements...
Please could someone let me know why this isn't working? Maybe there's a problem with the path already being instantiated in the first term, and so the retract function can't remove it, but how then are we to tell the retract function which path to remove (without keeping it in a dynamic list???)?
Thanks in advance (Apologies for the encyclopedia above...)
Mac