title: Usage of distinct still leading to duplicates
body: <p>I'm new to prolog, and as I understand it, the purpose of 'distinct' is to weed out duplicates. However, this code block: </p>
  
  <pre><code>allpartsincity(City):-
      distinct((proj(Project, _, City), sppj(_, Part, Project, _), part(Part, _, _, _, _))),
      part(Part, Name, Color, Num, X),
      format('~w ~w ~w ~w ~w ~n', [Part, Name, Color, Num, X]),
      fail
      ;
      true.
  </code></pre>
  
  <p>yields the following:</p>
  
  <pre><code>?- allpartsincity(london).
  p2 bolt green 17 paris 
  p5 cam blue 12 paris 
  p2 bolt green 17 paris 
  p6 cog red 19 london 
  p5 cam blue 12 paris 
  true.
  </code></pre>
  
  <p>I'm not sure what I'm missing, but I'd appreciate if someone could point me in the right direction.</p>