Re: [eclipse-users] Retract

From: Kish Shen <kisshen_at_...5...>
Date: Tue, 09 Oct 2007 10:32:36 +0100
Wojciech Pieprzyca wrote:
> Dear users!
>
> I have got a very simple question.
> Is it possible to remove (retract) facts loaded from static file ?
> I try to use retract but this works only for facts declared
> dynamically with assert predicate.
>
> Best regards,
> Wojciech Pieprzyca
>
> _______________________________________________
> ECLiPSe-Users mailing list
> ECLiPSe-Users_at_...2...
> http://www.crosscoreop.com/mailman/options/eclipse-users
>   
Hi Wojciech,

I am not clear what you want to do: if you want to do dynamic 
programming, i.e. you want to be able to assert and retract clauses (not 
just facts) for a predicate, you can declare the predicate as dynamic, e.g.

:- dynamic foo/1.

This can be done as a directive in the module you have the predicate 
(foo/1), before any definitions of the predicate.  This can occur in a 
file along with the rest of your code.

You should really only do this if you want to modify your program at 
run-time. If you want to simply store information, there are better ways 
to do this in ECLiPSe -- see the `Non-logical Storage and References' 
chapter of the User Manual:

http://www.eclipse-clp.org/doc/userman/umsroot052.html

If what you want to do is to remove code and definitions you loaded in 
to a module, you can erase the whole module with the erase_module/1 
built-in.

Cheers,

Kish
Received on Tue Oct 09 2007 - 10:33:34 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST