What does the s() predicate do in Prolog?
问题 I have been trying to learn Prolog, and am totally stumped on what the predicate s() does. I see it used often and there is so little resources on the internet about Prolog that I cannot find an answer. Ex. /* sum(Is,S) is true if S is the sum of the list of integers Is. */ sum([],0). sum([0|Is],S):-sum(Is,S). sum([s(I)|Is], s(Z) ):-sum([I|Is],Z). 回答1: s/1 does not do anything in itself, and it's not really a predicate. They are just terms, a representation of the successor of their argument.