[net.lang.prolog] A bug with general interest in C-Prolog 1.4a

RAAN@TECHUNIX.BITNET (03/01/85)

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

<Do you line eaters really exist?>

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