如何在 gprolog 或 swi-prolog 下编译或运行这两个文件?
我有两个文件:
样品.pl:
foo ( arg1, arg2 ) :- !, a ( arg1 ).
测试.pl:
a(1).
a(2).
a(3).
a(4).
a(5).
如何在 gprolog 或 swi-prolog 下编译或运行这两个文件?
我有两个文件:
样品.pl:
foo ( arg1, arg2 ) :- !, a ( arg1 ).
测试.pl:
a(1).
a(2).
a(3).
a(4).
a(5).
You can use the "consult" command to load and compile files.
consult(test).
In order to load several files, you need to consult each file in its own command. These commands should do the trick for you.
consult(sample).
consult(test).
它只是语法糖,但您也可以使用
['file.pl'].
这将编译一个 prolog 文件