diff --git a/exercises/cmember.pl b/exercises/cmember.pl index 17e392d..7c273e6 100644 --- a/exercises/cmember.pl +++ b/exercises/cmember.pl @@ -4,4 +4,9 @@ */ member1(X, [X | _]) :- !. -member1(X, [_ | T]) :- member1(X,T). \ No newline at end of file +member1(X, [_ | T]) :- member1(X,T). + +cmember(X, L, N) :- X > N, !, member1(X, L). +cmember(_, L, N) :- member1(N, L). + +myrepeat :- true; myrepeat. diff --git a/exercises/labs.pl b/exercises/labs.pl index 355c0dd..0bbb144 100644 --- a/exercises/labs.pl +++ b/exercises/labs.pl @@ -4,5 +4,6 @@ takes(turing, cs307). takes(hopper, cs307). takes(alberuni, cs220). -takes_lab(S) :- has_lab(Y), takes(S, Y). -has_lab(X) :- meets_in(X, Y), is_lab(Y). \ No newline at end of file + +takes_lab(S) :- takes(S, Course), meets_in(Course, Room), is_lab(Room). + diff --git a/exercises/resolution.pl b/exercises/resolution.pl index dd2ed5f..9920785 100644 --- a/exercises/resolution.pl +++ b/exercises/resolution.pl @@ -2,4 +2,4 @@ takes(jane_doe, cs254). takes(ajit_chandra, art302). takes(ajit_chandra, cs254). -classmates(X, Y) :- takes(X, Z), takes(Y, Z). \ No newline at end of file +classmates(X, Y) :- takes(X, Z), takes(Y, Z), not(X = Y). \ No newline at end of file