谓词保护的prolog错误

谓词保护的prolog错误,prolog,Prolog,它显示谓词受保护。我可以知道怎么解决吗?您的问题是第一行的nl后面有一个句点,而不是逗号,因此在序言中,您似乎在重新定义逗号运算符,而不是定义选项/1谓词。但这正是你的问题开始的地方 option(d):-write('Delete existing route'),nl. write('Please key in the type of transportation[c=byCar/p=byPlane/t=byTrain] '),read(R1),nl, write('Please

它显示谓词受保护。我可以知道怎么解决吗?

您的问题是第一行的
nl
后面有一个句点,而不是逗号,因此在序言中,您似乎在重新定义逗号运算符,而不是定义
选项/1
谓词。但这正是你的问题开始的地方

option(d):-write('Delete existing route'),nl.
   write('Please key in the type of transportation[c=byCar/p=byPlane/t=byTrain] '),read(R1),nl,
   write('Please key in the starting point of destination: '),read(S1),nl,
   write('Please key in the ending point of destination: '),read(D1),run4(R1,S1,D1),nl,
   write('Delete existing travelling alternative record success!'),nl,nl,menu.