% Default node-wide shared database. human(socrates). human(plato). human(aristotle). ancestor_descendant(X, Y) :- parent_child(X, Y). ancestor_descendant(X, Z) :- parent_child(X, Y), ancestor_descendant(Y, Z). parent_child(X, Y) :- mother_child(X, Y). parent_child(X, Y) :- father_child(X, Y). mother_child(trude, sally). father_child(tom, sally). father_child(tom, erica). father_child(mike, tom). echo_server :- echo_actor. echo_actor :- receive({ echo(From, Msg) -> From ! echo(Msg), echo_actor }). alarm :- receive({ ring -> writeln('Alarm ringing!'), alarm; stop -> true }). fridge(FoodList0) :- receive({ store(From, Food) -> self(Self), From ! Self-ok, fridge([Food|FoodList0]); take(From, Food) -> self(Self), ( select(Food, FoodList0, FoodList) -> From ! Self-ok(Food), fridge(FoodList) ; From ! Self-not_found, fridge(FoodList0) ); terminate -> true }).