title: Strange results for list manipulation
body: <p>I'm trying to implement some predicates for list manipulation in Prolog.
  Everything works as desired. For example</p>
  
  <pre><code>append([],Ys,Ys).
  append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs). 
  </code></pre>
  
  <p>Sample query:</p>
  
  <pre><code>?- append([1,2,3],[4,5,6],X).
  X = [1,2,3,4,5,6].                   % OK
  </code></pre>
  
  <p>But I'm having trouble with the <em>'delete'</em>-predicate. Here's how it's implemented:</p>
  
  <pre><code>delete(X,[Y|Ys],Zs) :- X == Y, delete(X,Ys,Zs).
  delete(X,[_X|Ys],[_Z|Zs]) :- delete(X,Ys,Zs).
  delete(_X,[],[]).
  </code></pre>
  
  <p>Sample query with bad result:</p>
  
  <pre><code>?- delete(4,[1,2,3,4],X).
  X = [_G8975, _G8978, _G8981].       % BAD
  </code></pre>
  
  <p>I've tested it with further input and it always returns a list of the expected length so in a way it works. But why am I getting only those cryptic _GXXXX and not the numbers?</p>
  
  <p>Many thanks in advance!</p>