Re: Art of Prolog Exercise problem
- From: Roland Illig <roland.illig@xxxxxx>
- Date: Mon, 10 Oct 2005 11:48:15 +0200
David W. wrote:
busy(Lecturer, Time) :- course(Course, time(Day, Start, Finish), Lecturer, place(Building, Room)),
lecturer(Lecturer, Course), teaches(Lecturer, Day), location(Course, Building), occupied(Room, Day, Time).
Slightly reindented:
busy(Lecturer, Time) :-
course(Course, time(Day, Start, Finish),
Lecturer, place(Building, Room)),
lecturer(Lecturer, Course),
teaches(Lecturer, Day),
location(Course, Building),
occupied(Room, Day, Time).The lecturer() line is superfluous. If there is a course(C, _, L, _), it is obvious that lecturer(C, L) is also true.
Same for teaches(L, D).
Same for location(C, B).
This leaves us with the following:
busy(Lecturer, Time) :-
course(_, time(Day, _, _), Lecturer, place(_, Room)),
occupied(Room, Day, Time).This means: Lecturer is busy when there is any course in the same Room and on the same Day, no matter what the lecturer of that course is.
Roland .
- References:
- Art of Prolog Exercise problem
- From: David W .
- Art of Prolog Exercise problem
- Prev by Date: Art of Prolog Exercise problem
- Next by Date: Re: Art of Prolog Exercise problem
- Previous by thread: Art of Prolog Exercise problem
- Next by thread: Re: Art of Prolog Exercise problem
- Index(es):
Relevant Pages
|
|