Skip to content

Instantly share code, notes, and snippets.

@pnathan
Created November 25, 2013 08:35
Show Gist options
  • Save pnathan/7638245 to your computer and use it in GitHub Desktop.
Save pnathan/7638245 to your computer and use it in GitHub Desktop.
Schedule suggester
% given constraints on a schedule with multiple people, find out what slots work.
available(monday, morning, jim).
available(tuesday, afternoon, jim).
available(wednesday, morning, jim).
available(wednesday, morning, julia).
available(tuesday, afternoon, james).
available(friday, afternoon, james).
available(wednesday, morning, james).
available(thursday, afternoon, mary).
available_times([P1 | PRest], Day, Time) :-
available(Day, Time, P1),
available_times(PRest, Day, Time).
available_times([], Day, Time).
all_availability(Plist, Bag) :-
findall([D,T], available_times(Plist, D, T), Bag).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment