2013-10-04 3 views
1

Le "problème" auquel je suis confronté est que si j'utilise le système module SWI-Prolog, en définissant des modules et en les utilisant dans d'autres modules, importé modifications du module SWI-Prolog n'en tient pas compte lors du chargement du en important le module. Par exemple:Recharger les modules importés

% file topmod.pl 
:- module(topmod, [thetop/0]). 

:- use_module(bottommod). 

thetop :- 
    thebottom(S), 
    format('This is the top~nAnd this is ~w~n', [S]). 

% file bottommod.pl 
:- module(bottommod, [thebottom/1]). 

thebottom('the bottom'). 

Si je les charge maintenant:

?- [thetop]. 
% bottommod compiled into bottommod 0.00 sec, 2 clauses 
% topmod compiled into topmod 0.00 sec, 6 clauses 
true. 

?- thetop. 
This is the top 
And this is the bottom 
true. 

Si je change maintenant le fichier:

% file bottommod.pl changes 

- thebottom('the bottom'). 
+ thebottom('the foobar'). 

?- [thetop]. 
% topmod compiled into topmod 0.00 sec, 1 clauses 
true. 

?- thetop. 
This is the top 
And this is the bottom 
true. 

?- module(bottommod). 
true. 

?- listing. 
thebottom('the bottom'). 
true. 

Comment dois-je forcer Prolog à consulter tous les modules importés et modules qu'ils importent, à court d'utiliser consult?

Répondre

6

Vous pouvez utiliser le prédicat SWI-Prolog make/0 pour recharger tous les fichiers source modifiés depuis le dernier chargement.

+0

Le raccourci est Ctrl + C + M ... – CapelliC

+3

Mieux vaut préciser où ce raccourci est significatif. –

Questions connexes