fork(1) download
  1. can_phone(anne,bill).
  2. can_phone(anne,mary).
  3. can_phone(bill,tom).
  4. can_phone(bill,sue).
  5. can_phone(tom,liz).
  6. can_phone(tom,frank).
  7. can_phone(liz,frank).
  8. message_route(A,B,[A,B]) :- can_phone(A,B).
  9. message_route(A,B,[A|Tail]) :- can_phone(A,X), message_route(X,B,Tail).
  10. :-message_route(anne,frank,Chain), write(Chain).
Success #stdin #stdout 0.02s 6160KB
stdin
Standard input is empty
stdout
[anne, bill, tom, frank]