title: Input list not obtained in Prolog
body: <p>I am using following code: </p>
  
  <pre><code>item(a, b, c).
  item(a, a, c).
  item(a, d, c).
  item(a, c, b).
  
  main:-
      getItems(L),
      writeln('-----------1-------------'),
      writeln(L),
      findall((A,B,C), item(A,B,C), M),
      writeln('-----------2-------------'),
      compareItem(M,L,I),
      writeln('-----------3-------------'),
      writeln(I).
  
  getItems([Item|List]):-
      writeln('Enter:'),
      read(Item),
      dif(Item,stop),
      getItems(InputList).
  
  getItems([]).
  
  compareItem([H|T],L,Out):-
      writeln('-----------4-------------'),
      intersection(H,L,I),
      writeln('-----------5-------------'),
      compareItem(T,L,[I|Out]).
  compareItem([],L,Out).
  </code></pre>
  
  <p>It gives following output: </p>
  
  <pre><code>?- main.
  Enter:
  |: a.
  Enter:
  |: b.
  Enter:
  |: stop.
  -----------1-------------
  [a|_G1003]
  -----------2-------------
  -----------4-------------
  -----------1-------------
  [a|_G1003]
  -----------2-------------
  -----------4-------------
  -----------1-------------
  []
  -----------2-------------
  -----------4-------------
  false.
  
  4 ?-
  </code></pre>
  
  <p>The input method has been taken from: <a href="https://stackoverflow.com/questions/31710213/creating-a-list-from-user-input-with-swi-prolog">Creating a list from user input with swi-prolog</a></p>
  
  <p>I get following when commands are run separately: </p>
  
  <pre><code>?- findall((A,B,C), item(A,B,C), M)
  M = [ (a, b, c), (a, a, c), (a, d, c), (a, c, b)].
  ?- intersection([a,b,c],[a,b],I).
  I = [a, b].
  </code></pre>
  
  <p>However, it is [(a,b,c),...] in M and I expected user input to be [a,b] (here it is blank). </p>
  
  <p>I want the output to be the intersection of user input with each of items in M: </p>
  
  <pre><code>[(a,b), (a,a), (a), (a,b)]
  </code></pre>
  
  <p>Also, after reaching point 4, how does the execution reach again point 1?</p>
  
  <p>How can these be corrected? Thanks. </p>