abolish(+module_name, @predicate_indicator)

This built-in predicate removes all clauses, from a module, that have the same name and arity as specified by the predicate indicator. The first argument must be the name of a module currently loaded, not the filename of a file in the module. The second argument must be a predicate indicator like: test/1. The clauses may only be removed from the module if they were defined as dynamic, see dynamic/1 or dynamic/2. If abolish/2 does not throw an exception then it is always exited successfully. Other built-in clauses that remove clauses from a module are abolish/1, retract/1 and retract/2.

see also: abolish/1 asserta/1 assertz/1 asserta/2 assertz/2 dynamic/1 dynamic/2 predicate indicators retract/1 retract/2 set_active_module/0 set_active_module/1

Example
abolish( data, test / 1 ). removes all predicates with the name 'test' that have 1 argument from the module 'data'

 

Exceptions
The first argument is a variable an instantiation_error exception is thrown
The first argument Arg is not an atom a type_error(atom, Arg) exception is thrown
No module with the specified Name exists an existence_error(module, Name) exception is thrown.
Predicate to remove is not declared dynamic a exception permission_error(modify, static_procedure, Pred) is thrown, Pred is replaced by the predicate indicator argument
Predicate to remove is a built-in predicate a exception permission_error(modify, static_procedure, Pred) is thrown, Pred is replaced by the predicate indicator argument
for more possible exceptions see predicate indicators 

 

 

info@trinc-prolog.com