title: How to access facts inside list
body: <p>I'm trying to extract the elements of a list of pairs, but I'm only able to access the pairs. If I have a list like this:</p>
  
  <pre><code>list([p(a,b),p(c,d)]).
  </code></pre>
  
  <p>How can I access the elements <code>a, b, c, d</code>. For example, if I run:</p>
  
  <pre><code>list_s(X) :- list(L), member(X,L).
  
  ?- list_s(X).
  X = p(a,b),
  X = p(c,d)
  </code></pre>
  
  <p>I get all the pairs in the list. But I'm trying to write a rule:</p>
  
  <pre><code>listSelect(X) :- list(X), ( ... something).
  
  ?- listSelect(X).
  X = a,
  X = b,
  X = c,
  X = d
  </code></pre>
  
  <p>Is it possible to make a rule to do something like this?</p>