3 ms·
>> (For instance "success" is often represented as a logical false and "failure" as a logical true) I'm confused by this. false/0 (or fail/0, equivalently) is
by YeGoblynQueenne 3y ago
>> (For instance "success" is often represented as a logical false and "failure" as a logical true)
I'm confused by this. false/0 (or fail/0, equivalently) is used to force a clause to fail. Frex:
p(X,Y):- false.
Will always fail, not succeed. So what do you mean?
- i_don_t_know 3y agoNot OP. He might be referring to the looping or enumeration pattern: evaluate some clause to get the first solution, “fail” to trigger backtracking and to get the next solution, etc. At the very end after printing all solutions, the program returns “No” because there are no solutions left.
- YeGoblynQueenne 3y agoMaybe, but that's known as a "failure-driven loop", in Prolog parlance, so it's still not clear to me how "success is represented as a logical false". Also, "false/0" is extra logical.