title: user defined square predicate
body: <p>I am using SWI-Prolog V 6.2.3 on Windows 7. I have written the following predicates that calculate the absolute value and the square of an integer:</p>
  <pre><code>myabs(X,X):- X &gt; = 0.
  
  myabs(X,Y):- Y is -X.
  
  mysq(X,S):- myabs(X,Y), S is Y * Y.
  </code></pre>
  <p>I get errors (operator error) for the following lines:</p>
  <blockquote>
  <p>2 : Prolog does not seem to accept -X.</p>
  <p>3 : Prolog does not seem to accept Y * Y (when replaced by 2 * 2, I don't get error)</p>
  </blockquote>
  <p>I understand there are built-in predicates for these functions, but as I am new, these are small programs that help me learn.</p>