Skip to content

Commit 08057fc

Browse files
authored
Update practical-session.pl
Hi, I think question 1 requires us to use cut-fail combination to solve the problem without using =.
1 parent b10a4b0 commit 08057fc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

chapter-10/practical-session.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@
454454
notUnifiable(X, Y) :- neg(X = Y).
455455

456456
%% Third, write it using a cut-fail combination. Don’t use = and don’t use \+.
457-
notUnifiable(X, Y) :- X \= Y.
457+
notUnifiable(X,X) :-
458+
!,fail.
459+
notUnifiable(_,_).
458460

459461
%% Define a predicate unifiable(List1,Term,List2) where List2 is the list of all
460462
%% members of List1 that unify with Term. The elements of List2 should not be

0 commit comments

Comments
 (0)