我在堆栈溢出时搜索了 Prolog Operator 预期的错误问题,但是我无法识别我得到的错误:
4:26: Syntax error: Operator expected
% 3.pl compiled 0.00 sec, 3 clauses
代码很简单:
inc(N,R) :-
R is N + 1. % Simple code to increment a number.
mapcar( F , [] , [] ). % Base case
mapcar( F , [H|T] ,[RH|RT] ) :- % Increment head and put it in Result Head and Recurse for Tail
F(H,RH),
mapcar(F,T,RT).