I am learning Prolog using SWI-Prolog.
Here is my practice code in file fact.pl
:
factorial(N,F) :- N is 0, F is 1;
N > 0, M is N - 1, factorial(M,G), F is N*G.
While I was trying to load this file by using [fact.pl]
, the interpreter gives me the following error:
?- [fact.pl].
ERROR: Syntax error: Operator expected
ERROR: [fact
ERROR: ** here **
ERROR: .pl] .
I am not sure how this happens, and I am pretty sure what I have done is the standard program loading command.
Anyone has ever seen this please help, thank you.
either ?- [fact].
or ?- ['fact.pl'].
should work