title: Prolog - generating numbers fitting given range
body: <p>I'd like to use predicates like:</p>
  
  <pre><code>range(X,0,5)
  range(X,4,200)
  range(X,-1000000,1000000)
  dom_range(X,-1000000,1000000)
  </code></pre>
  
  <p>with meaning :</p>
  
  <pre><code>range(X,0,5) :- member(X,[0,1,2,3,4,5]).
  range(X,4,200) :- member(X,[4,5,6...198,199,200]).
  range(X,-1000000,1000000) :- member(X,[-1000000,...,1000000]).
  dom_range(X,-1000000,1000000) :- domain(X, [-1000000,...,1000000]).
  </code></pre>
  
  <p>How to code it in Prolog nicely (taking solution performance into account - depth of recursion etc) ?</p>
  
  <p>Solution is expected to run on GNU-Prolog.</p>
  
  <p>P.S. Question inspired with <a href="https://stackoverflow.com/questions/1956798/prolog-syntax-problem">this question</a>.</p>