문제

hi(g,plus(A,B),int) :- hi(g,A,int),hi(g,B,int),!.  

in the above statement what does the '!' sign at the end of the statement do ?

도움이 되었습니까?

해결책

That's the cut operator, which basically states "if we got up to here, don't backtrack."

So, if both recursive calls succeed, the hi predicate will not retry them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top