Reputation: 43833
In prolog, is it possible to force a fail? Something like:
check(F,A,[1,2,3]) :- FAIL.
check(F,A,_) : greater_than(F,A).
This may be a bad example, but something along the lines of this.
So if it does a pattern match on F,A,[1,2,3], then we just stop the who unifying process, and return a false.
Upvotes: 0
Views: 2088
Reputation: 726499
Prolog has a built-in fail/0
predicate, which always fails. You need a cut !
in front of it in order to prevent further matching of the same check/3
rule:
check(F,A,[1,2,3]) :- !, fail.
Upvotes: 1