3

私が直面している「問題」は、SWI-Prolog モジュール システムを使用し、モジュールを定義して他のモジュールで使用する場合、インポートされたモジュールが変更された場合、SWI-Prolog はインポートモジュールをロードするときにそれを考慮しないことです。例えば:

% 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').

私が今それらをロードした場合:

?- [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.

ファイルを変更した場合:

% 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.

Prolog に、インポートされたすべてのモジュールとそれらがインポートするモジュールを使用せずに参照させるにはどうすればよいconsultですか?

4

1 に答える 1

8

SWI-Prologmake/0述語を使用して、最後にロードされてから変更されたすべてのソース ファイルを再ロードできます。

于 2013-10-04T11:17:20.707 に答える