title: How to create a list from facts in Prolog?
body: <p>There are these facts:</p>
  
  <pre><code>man(john).
  man(carl).
  woman(mary).
  woman(rose).
  </code></pre>
  
  <p>I need to create the predicate people(List), which returns a list with the name of every man and woman based on the previous facts. This is what I need as output:</p>
  
  <pre><code>?- people(X).
  X = [john, carl, mary, rose]
  </code></pre>
  
  <p>And here is the code I wrote, but it's not working:</p>
  
  <pre><code>people(X) :- man(X) ; woman(X).
  people(X|Tail) :- (man(X) ; woman(X)) , people(Tail).
  </code></pre>
  
  <p>Could someone please help?</p>