1

I have facts:

/**--(course,time,location)--*/

ctl('course1', 'time1','location1').
ctl('course2', 'time1','location2').
ctl('course3', 'time2','location3').

/**--Lecturer,course-*/

lc('lecturer1','course1').
lc('lecturer2','course2').
lc('lecturer1','course3').

and my rule for lecturer's schedule(course,time,location) is:

schedule(Lecturer,C,T,L) :-
   lc(Lecturer,C),ctl(C,T,L).

If I do: ?- schedule('lecturer1',C,T,L). to check what is lecturer1's schedule,it will output 2 groups of answer,

but if I do: ?- schedule(Lecturer,C,'time1',_). to check who is scheduled to teach what on time1, it will should "false" after output 2 groups of answer.

Does anyone how to fix the "false"?

false
  • 10,264
  • 13
  • 101
  • 209
Layla
  • 133
  • 3
  • 12

1 Answers1

3

There's no need to fix anything; the false simply means Prolog can't find any more solutions. It's harmless.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836