3

如何在 gprolog 或 swi-prolog 下编译或运行这两个文件?

我有两个文件:

样品.pl:

foo ( arg1, arg2 ) :- !, a ( arg1 ).

测试.pl:

a(1).
a(2).
a(3).
a(4).
a(5).
4

2 回答 2

4

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).
于 2012-05-31T10:00:19.720 回答
2

它只是语法糖,但您也可以使用

    ['file.pl'].

这将编译一个 prolog 文件

于 2012-06-02T15:07:25.133 回答