title: Prolog - Recursive List
body: <p>Here is my question:
  A small club decided to set up a telephone network for urgent messages
  amongst its members. The following arrangement was agreed:
  Anne can phone both Bill and Mary. Bill can phone both Tom
  and Sue. Tom can phone both Liz and Frank. Liz can also phone
  Frank if necessary.</p>
  
  <p>Express this information as seven Prolog facts of the form
  <code>can_phone(anne,bill)</code>. Now write recursive Prolog rules for a predicate message_route such
  that <code>message_route(A,B,R)</code> is true if <code>A</code> can pass a message to <code>B</code> routed
  via the people in list <code>R</code>, using the club’s telephone arrangements. For
  example, <code>message_route(anne,frank,[anne,bill,tom,liz,frank])</code>
  would be true (because <code>anne</code> can phone <code>bill</code>, who can phone <code>tom</code>,
  who can phone <code>liz</code>, who can phone <code>frank</code>).</p>
  
  <p>I have this so far:</p>
  
  <pre><code>can_phone(anne,bill).
  can_phone(anne,mary).
  can_phone(bill,tom).
  can_phone(bill,sue).
  can_phone(tom,liz).
  can_phone(tom,frank).
  can_phone(liz,frank).
  </code></pre>
  
  <p>For my <code>message_route</code>, I have experimented and have this working which allows me to complete the second part of the question without the requirement of restricting the list to a specified list of persons (<code>R</code>).</p>
  
  <pre><code>message_route(A,B) :- can_phone(A,B).
  message_route(A,B) :- can_phone(A,X), message_route(X,B).
  </code></pre>
  
  <p>I don't understand how to implement this list in my answer.</p>