title: Prolog Create a List
body: <p>I have to  create list of n elements for example,</p>
  
  <pre><code>do_list(5,L1).
  </code></pre>
  
  <p>should return, </p>
  
  <pre><code>L1=[1,2,3,4,5].
  </code></pre>
  
  <p>This is what I have, but it's not working.</p>
  
  <pre><code>do_list(X,L1):- X1 is X-1, do_list(X1,[X1|L1]).
  
  do_list(0,[]).
  </code></pre>