Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site ucbvax.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!ucbvax!RAAN@TECHUNIX.BITNET
From: RAAN@TECHUNIX.BITNET
Newsgroups: net.lang.prolog
Subject: A bug with general interest in C-Prolog 1.4a
Message-ID: <5147@ucbvax.ARPA>
Date: Fri, 1-Mar-85 10:16:10 EST
Article-I.D.: ucbvax.5147
Posted: Fri Mar  1 10:16:10 1985
Date-Received: Sat, 2-Mar-85 04:48:26 EST
Sender: daemon@ucbvax.ARPA
Organization: University of California at Berkeley
Lines: 36

From: raan@techunix.bitnet (Ran Ever-Hadani)



Given is the following goal:

	assert(a),a,once_detract(a),assert(a),fail.

(*once_detract* is a detract that succeeds only once)
Assuming an initially empty data base, the first *assert* will
add the clause *a.* to the data base, the *a* will succeed, 
the *detract* will delete it, the second *assert* will add a 
new one, the second attempt to *once_detract* will fail, and finally
control would try to match another *a.*.
At this point there are two possibilities:
    1) Since a new *a.* has been asserted, it would succeed.
    2) After the first time *a* succeeds, it would be
       marked somewhere that there are no more *a*'s and even though
       another one was added in the meanwhile, the second attempt
       will fail.

There are arguments for defining it either way. Unfortunately,
C-Prolog 1.4a takes the first alternative with debug on, and the
second with debug off, which caused me a hell of a headache trying
to figure out why my program does not behave the same with debug on
and off.
The solution that worked for me was to replace every such *a,*
in my program with *clause(a,true),* which takes the first way
with debug on and off.

If someone out there knows who maintains C-Prolog, I will appreciate
it if he passes my letter on.

					Ran Ever-Hadani
					Technion, Haifa, Israel
					Bitnet: raan@techunix