2013-03-10 41 views

回答

2

通過與蓄能器的參數的尾遞歸輔助謂詞執行循環:

xsum(K,X,S):- K>=1, zsum(X,1,K,1,0,S). 

zsum(X,I,K,PrevTerm,PrevSum,S):- 
    I=:=K, Term is ________ * X/I, S is _____ + _____. 

zsum(X,I,K,PrevTerm,PrevSum,S):- 
    I < K, Term is ________ * X/I, Sum is _____ + _____, I1 is I+1, 
    zsum(X,I1,K,Term,Sum,S). 

填空。 :)

這些子句是互斥的,所以謂詞是確定性的。