Prolog program returns false
问题 I implemented the following power program in Prolog: puissance(_,0,1). puissance(X,N,P) :- N>0,A is N-1, puissance(X,A,Z), P is Z*X. The code does what is supposed to do, but after the right answer it prints "false.". I don't understand why. I am using swi-prolog. 回答1: You can add a cut operator (i.e. ! ) to your solution, meaning prolog should not attempt to backtrack and find any more solutions after the first successful unification that has reached that point. (i.e. you're pruning the