Turbo Prolog
Turbo Prolog
Turbo Prolog
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Determinism, Non-determinism and How to Set the Cut<br />
The compiler directive checLdeterm is useful when you need to decide where to place<br />
the cut, since it marks those clauses which give rise to non-deterministic predicates. If<br />
you want to make these predicates deterministic, the cut will have to be inserted to<br />
stop the backtracking (which causes the non-determinism). As a general rule in such<br />
cases, the cut should always be inserted as far to the left as possible without destroying<br />
the underlying logic of the program.<br />
Domains Containing References<br />
Consider the predicate lookup in Program 62 during the evaluation of the goal<br />
lookup(tom,27,Tree),<br />
lookup(dick,28,Tree),<br />
lookup(harry,26,Tree).<br />
II Program 62 II<br />
domains<br />
tree reference t(id,val,tree,tree)<br />
id = symbol<br />
val = integer<br />
predicates<br />
lookup(id,val,tree)<br />
clauses<br />
lookup(ID,VAL,t(ID,VAL,_,_)):-l.<br />
lookup(ID,VAL,t(ID1,_,TREE,_)):<br />
ID