How to compile prolog code in ubuntu

prolog

How can I compile or run below these two files under gprolog or swi-prolog?

I have two files:

sample.pl:

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

test.pl:

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

Best Answer

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).
Related Topic