Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prolog, fail and do not backtrack

Is there any build-in predicate in SWI-Prolog that will always fail AND prevent machine from backtracking - it is stop the program from executing immediately (this is not what fail/0 does)? I could use cuts, but I don't like them.

Doing something like !, fail is not a problem for me, but in order to accomplish what I want, I would have to use cuts in more locations and this is what I don't like.

like image 751
Jerry Avatar asked Dec 06 '22 02:12

Jerry


1 Answers

You could use exceptions. Based on your question - it should help. Refer link

like image 93
Volodymyr Gubarkov Avatar answered Jan 04 '23 15:01

Volodymyr Gubarkov