To tune the initialization of a file or system to be run only when it
should be run,
volatile/1, in combination with other declarations,
initialization/1 the information
necessary to distinguish different loading situations. In the reference
pages, we show how some common situations can be programmed using
If a source file contains data that is supposed
to be transformed according to some complicated rules (which cannot be
term_expansion/2), and the data after the transformation can
be saved into a saved state, we might want the transformation to be
done when the file is loaded, but not when a saved state is restored.
The following program defines the initialization to be run only when
the file is loaded:
:- dynamic do_not_transform/0. % reset fact :- initialization my_init. my_init :- ( do_not_transform -> true ; undo_transform, % remove old data do_transform, assert(do_not_transform) ).
In the above example,
undo_transform/0 are user defined.