[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question on assert and retract
From: |
spratt |
Subject: |
Re: question on assert and retract |
Date: |
Tue, 27 Aug 2002 14:14:46 -0500 |
On Tuesday, August 27, 2002, at 01:31 PM, bruno patin wrote:
But now, as listing is not an iso-prolog directive how not to add the
same facts two times ?
Perhaps my_assertz:
my_assertz(Term) :-
(var(Term)
;
copy_term(Term, TermCopy),
my_clause(TermCopy) )
-> true
;
assertz(Term).
my_clause( Term ) :-
Term =.. [ (:-), Head, Body]
-> clause(Head, Body)
;
clause(Term, true).
This only assertz's Term if Term is ground (i.e. contains no unbound
variables) and is not unifiable with a clause already in the clause
database.
This predicate may raise an exception in some Prolog systems if Term
refers to a non-interpreted predicate, due to the use of clause/2.
and has assertz the same comportment in other prolog implementations ?
Yes, I believe so.
-lindsey
- question on assert and retract, bruno patin, 2002/08/26
- Re: question on assert and retract, Vic Bancroft, 2002/08/26
- Re: question on assert and retract, Timo Karjalainen, 2002/08/27
- Re: question on assert and retract, Vic Bancroft, 2002/08/27
- Re: question on assert and retract, bruno patin, 2002/08/27
- Re: question on assert and retract,
spratt <=
- Re: question on assert and retract, spratt, 2002/08/27
- Re: question on assert and retract, David Bennett, 2002/08/27
- Re: question on assert and retract--ground testing., spratt, 2002/08/27
- Re: question on assert and retract--ground testing., David Bennett, 2002/08/27
- Re: question on assert and retract, Vic Bancroft, 2002/08/27