以下代码不起作用
:- arithmetic_function(i/2).
i(X,Y,Z) :-
Z is X+Y.
calcola :-
write('Give me an expression'),nl,
read(ESP),
Z is ESP,nl,nl,
write(Z).
但以下是
:- arithmetic_function(i/2).
i(X,Y,Z) :-
Z is X+Y.
calcola :-
write('Give me an expression'),nl,
Z is 4 i 2,nl,nl,
write(Z).
这是为什么?似乎“读取”功能无法正常工作