pfc
pfc

Reputation: 1910

Prolog syntax error: operator expected

I was studying the Prolog, and met with the "syntax error: operator expected" for the following code:

odd_list(X,Y):-process_list(X,Y,1).
process_list(X,[N1|Y],N):-N1 is 2*N-1,N1 < X,N2 is N+1,process_list(X,Y,N2).
process_list(X,[],N):-2*N-1>=X.

That's all the code I wrote. What's the problem? I found some solutions saying that there are unexpected white spaces in the functors or arguments, but I think I do not include any white space in the above-mentioned places. Thank you all for helping me!!!

Remark: I find that when I name the source code as "Test1.pl", I get this error. But when I name it as "test1.pl", there is no error. Does it mean that the file name cannot start with an upper case letter?

Upvotes: 1

Views: 2585

Answers (1)

pfc
pfc

Reputation: 1910

I found the reason for this problem. I used the file name 'Test1'. But Prolog does not support upper case letter in the file name. I modified the file name to 'test1' and it works now.

Upvotes: 2

Related Questions