6
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 ?

false
  • 10,264
  • 13
  • 101
  • 209

1 Answers1

11

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.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836