[net.lang.prolog] recorda,recorded,erase--behavior

toba@tkov58.DEC (Toshiya Toba, DEC-Japan SWS/TK2/AI-group) (02/13/86)

    Does anyone here faced the folling problem? 
    
    If key of the recorda(K,T,R) is same name as build in predicate,
    one can not erase(R) this Term, though it should have different R
    number that prolog build in predicate and thous one should erase
    such a Term.
    
    I have tried DEC-10 prolog, C-prolog, and Quintus prolog..
    both DEC-10 and Quintus can erase that term correctly but C-prolog
    does not.  (original programs were cross referencer, written in
    DEC-10 prolog)
    
    Tnx in advance for any comments.
                 
    --------program follows-------
    
    test:-recorda(arg(A,B,C), '$caller'(arg(A,B,C),empty,2,'test.dat')),
    	  recorded(arg(A,B,C),'$caller'(arg(A,B,C),X,Y,Z),R),
    	  erase(R).
    
    -------trace log follows-----
    |?-test.
    (1) 1 Call: test ?
    .........
    ........
    (4) 2 Call: recorded(arg(_0,_1,_2),$caller(arg(_0,_1,_2),_3,_4,_5),_3435 ?
    (4) 2 Exit: recorded(arg(_0,_1,_2),$caller(arg(_0,_1,_2),empty,2,test.dat),
      a00246e) ?
    (5) 2 Call: erase(a000264e) ?
    
    ! Attempt to erase a system object
                                      
    -------end log---------
                                    
    				Toshiya Toba
    		UUCP:		....!decwrl!dec-rhea!dec-tkov58!toba
		ARPA:		TOBA@MARLBORO.DEC.COM
		

sundar@cwruecmp.UUCP (Sundar R. Iyengar) (02/14/86)

I tested the problem in our Cprolog_1.5 on Vax (bsd4.2).  Yes, the erase
does fail if the key used in a corresponding 'recorda' is an evaluable
predicate.  However, the erase works just fine if the Key is a simple
atom.  Since the key used is only the functor of the first argument to
'recorda', you don't have to use the entire term.  So a temporary fix
for your problem would be,

	recorda(arg,...,R),
	recorded(arg,...X),
	erase(R).

However, I don't what is causing the problem.  I hope this helps.

sundar r. iyengar		

arpa:  sundar.case@csnet-relay     531, crawford hall
csnet: sundar@case		   case western reserve university
uucp:  decvax!cwruecmp!sundar	   cleveland, oh 44106