'How do you specify facts in prolog files?

I have a few facts stored in a file test.pl.

memory(0, 0, 0).
memory(0, 1, 0).
memory(0, 2, 0).

Now in the same directory, I start gprolog and load the file.

| ?- ['test.pl'].
compiling /home/cib/projects/prolog/test.pl for byte code...
/home/cib/projects/prolog/test.pl compiled, 3 lines read - 501 bytes written, 5 ms

yes

But it will treat the loaded facts strangely. Trying to query one of them:

| ?- memory(0, 1, 0).

true ? h
Action (; for next solution, a for all solutions, RET to stop) ? ;

no

It's like it's trying to list some unifications, only there are no variables to unify. If I specify the facts with [user], there's no problem.

| ?- [user].
compiling user for byte code...
memory(0, 1, 0).

user compiled, 2 lines read - 229 bytes written, 10237 ms
warning: user:1: redefining procedure memory/3
         /home/cib/projects/prolog/test.pl:1: previous definition

yes
| ?- memory(0, 1, 0).

yes

I really don't know what's going on. I've tried to look for some definitions of how file loading works and how it's different from the interpreter on google, but to no avail.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source