Prolog: how to check if the currently evaluated clause was cut?

42 Views Asked by At

As in the title, for example

test(X) :-
  ( was_cut -> X = yep
  ; X = nope
  ).
test(X) :-
  !,
  ( was_cut -> X = yep
  ; X = nope
  ).
test(X) :-
  X = none.

Would yield

?- test(X)
X = nope;
X = yep.

Asking certainly about SWI and/or SICSTUS implementations, but the other ones are welcome as well

0

There are 0 best solutions below