为什么这个阶乘实现不起作用:
factorial(0, B) :- B is 1.
factorial(A, B) :-
A > 0,
Ax is A-1,
B is A*Bx,
factorial(Ax, Bx).
这有效:
factorial2(0, B) :- B is 1.
factorial2(A, B) :-
A > 0,
Ax is A-1,
factorial2(Ax, Bx),
B is A*Bx.