I’d like to write a kind test predicate that takes as an argument a predicate and whether it is supposed to be true of false.
if call(X) succeeds and Truth = true, then test succeeds, and if call(X) fails and Truth=false, it succeeds as well.
I am thinking about two auxiliary predicates, but is there a more compact way to do this.
Right now i did it this way:
aux_call(X, true) :- !, call(X). aux_call(X, false) :- \+ call(X). test(X, Truth) :- aux_call(X, Truth).
I guess, this is pretty compact