1
votes

In Prolog using the cut. Why is the effect of the following query to return the following:

?- !,false.
no

yet this query returns the following:

?- !;false.
yes
1

1 Answers

2
votes

The first query performs an AND on ! (which always returns yes) and false, which always returns no. yes AND no = no.

In the second query, the ! commits execution to the first branch, that is, !, which always returns yes.