December 2021
Beginner
840 pages
47h 29m
English
The ! operator is the cut predicate in Prolog. The cut predicate gives the programmer a measure of control over the search process—an impurity—so it should be used with caution. (The use of the cut predicate in Prolog is, in spirit, not unlike the use of goto in C or call/cc in Scheme in its manipulation of normal program control.) Cut is a predicate that always evaluates to true:
However, the cut predicate has a side effect: It both freezes parts of solutions already found and prevents multiple/alternative solutions from being produced/considered. In this way, it prunes branches in the ...
Read now
Unlock full access