!/0 cuts through ,/2, ;/2 and ->/2, but it does not cut through call/1, not/1 or once/1.
Success: [eclipse]: [user]. or(A -> B, C) :- call(A), !, call(B). or(_ -> _, C) :- call(C). user compiled 412 bytes in 0.02 seconds [eclipse]: or(write(a)->fail, write(k)). a no. [eclipse]: or(fail->fail,write(k)). k yes. [eclipse]: [user]. echo :- repeat, read(X), echo(X), !. echo(end_of_file). echo(X) :- writeln(X), fail. user compiled 404 bytes in 0.02 seconds yes. % if the cut is left out, backtracking occurs. [eclipse]: echo. f(1,2). f(1,2) end_of_file. yes.