Różnice
Różnice między wybraną wersją a wersją aktualną.
|
|
pl:prolog:pllib:course_rules [2019/06/27 15:50] |
pl:prolog:pllib:course_rules [2019/06/27 15:50] (aktualna) |
| ====== Course rules ====== |
| {{tag>rules}} |
| ===== Description ===== |
| Course rules |
| |
| **Source**: The Art of Prolog |
| ===== Download ===== |
| Program source code: {{course_rules.pl}} |
| ===== Listing ===== |
| <code prolog> |
| lecturer(Lecturer,Course) :- |
| course(Course,Time,Lecturer,Location). |
| |
| duration(Course,Length) :- |
| course(Course,time(Day,Start,Finish),Lecturer,Location), |
| plus(Start,Length,Finish). |
| |
| teaches(Lecturer,Day) :- |
| course(Course,time(Day,Start,Finish),Lecturer,Location). |
| |
| occupied(Room,Day,Time) :- |
| course(Course,time(Day,Start,Finish),Lecturer,Location), |
| Start =< Time, Time =< Finish. |
| |
| % Program 2.4: Course rules |
| |
| </code> |
| ===== Comments ===== |
| |