title: Find a element of a list in a another list in Prolog
body: <p>i try to solve a problem about lists but i can't... :(</p>
  
  <p><strong>PLAYER(TEAM,[PLAYERS WHO PLAY IN THAT TEAM]).</strong></p>
  
  <pre><code>player(milan,[seedorf,zambrotta,gattuso]).
  player(inter,[seedorf,ronaldo,zambrotta]).
  player(realmadrid,[seedorf,zidane,ronaldo]).
  </code></pre>
  
  <p>and i try to write predicates that returns 2 Lists; P1 and P2... </p>
  
  <pre><code>find(P1,P2).
  </code></pre>
  
  <p>For example; if my goal is:</p>
  
  <pre><code>find([milan,inter],X). returns X:[seedorf,zambrotta]. 
                       players who played juventus and also inter 
  find([inter,realmadrid],X). returns X:[seedorf,ronaldo]  
                      players who played inter and also realmadrid
  find(X,[seedorf]). returns X:[juventus,inter,realmadrid]
                       teams that seedorf played
  find(X,[seedorf,ronaldo]). returns X:[inter,realmadrid]
                       teams that seedorf and ronaldo played.
  </code></pre>
  
  <p>i try to solve this but i can't go further than that (and it is not even enough to try P2 list members find in player facts :( ) :  MOREOVER I CANNOT USE "!" because of lecture restrictions.</p>
  
  <pre><code>find(P1,[P2|P2s]):-findall(X,player(X,P2),P1),find(P1,P2s).
  </code></pre>
  
  <p>Thanks A Lot....</p>