Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!mit-eddie!ll-xn!ames!ucbcad!ucbvax!hplabs!sdcrdcf!burdvax!bigburd!dowding
From: dowding@bigburd.PRC.Unisys.COM (John Dowding)
Newsgroups: comp.lang.prolog
Subject: Behavior of assert and retract
Message-ID: <3287@bigburd.PRC.Unisys.COM>
Date: Sat, 11-Jul-87 14:48:22 EDT
Article-I.D.: bigburd.3287
Posted: Sat Jul 11 14:48:22 1987
Date-Received: Wed, 15-Jul-87 03:35:43 EDT
Sender: news@bigburd.PRC.Unisys.COM
Organization: Unisys/Paoli Research Center, Paoli, PA
Lines: 38
Keywords: backtracking to retract

I  have just  had a  brief introduction  to Quintus  Prolog 2.0 after
having used version 1.5 for several years.   The  behavior of retract
has changed between these two releases.  

Basically, I have  a small  program that  traverses a  set of grammar
rules (stored in the clause database) that  is implemented  in a fail
loop:  

traverse_grammar :-
	retract(needs_visiting(Nonterminal)),
	visit_node(Nonterminal),
	fail.

The idea is that visit_node/1 will assert new clauses of
needs_visiting/1  as  it  finds  new  nonterminals  that  havent been
visited yet.  In Quintus Prolog 1.5 (and I believe CProlog) this will
work.  It does not work in Quintus Prolog 2.0,  Symbolics Prolog, and
Quintus Prolog on the Xerox Lisp machines.  

This  seems  to me  to be  reasonable program  to write.   Perhaps it
becomes  more  reasonable  if I  specify that  I want  the new clause
asserted with assertz, rather than asserta.  I think that it captures
the behavior that I want very succinctly.  

What do all the Prolog wizards have to say about this?


Thanks,

John Dowding

dowding@bigburd.prc.unisys.com


[ Please dont reply with lots of other ways to solve this problem
  (except perhaps for comparitive purposes).  Im not asking for 
  programming assistance.  I know of plenty of other solutions.]
--