title: How to consistently replace atoms with variables in Prolog?
body: <p>I am writing a parser for SPARQL (Semantic Web query language) using DCG. I want to replace SPARQL variable names with Prolog variables. How would I go about this?</p>
  
  <p>I can generate new variables using <code>length([NewVar], 1)</code>, but I cannot keep track of existing assignments by simply using a list of name-variable pairs. A <code>member/2</code> operation on the list will return a new variable, not the one stored in the list.</p>
  
  <p>Is there an easy way for naming variables in Prolog, e.g., <code>'$VAR(Name)'</code>?</p>