title: Clingo: create custom function
body: <p>I am at wit's end as to create a "function" in clingo, if such can be defined.
  In a simplified version of what I am trying to accomplish, I wrote this very short program:</p>
  
  <pre><code>a(1..3).
  
  adj(X,Y) :- a(X), a(Y), abs(X-Y)==1.
  
  #hide a/1.
  </code></pre>
  
  <p>Basically, I want to define an adjacency function that given any two numbers will hold <code>true</code> if the absolute value of their difference equals one. What I'd expect from the above program is to output the results: <code>adj(1,2) adj(2,1) adj(2,3) adj(3,2)</code>, yet I am presented with this output:</p>
  
  <pre><code>Answer: 1
  
  SATISFIABLE
  
  Models       : 1
  Time         : 0.000
    Prepare    : 0.000
    Prepro.    : 0.000
    Solving    : 0.000
  </code></pre>
  
  <p>(if I omit <code>#hide a/1.</code> it will output the answer: <code>a(1) a(2) a(3)</code>).</p>
  
  <p>I feel like this is clingo 101, so maybe I'm misunderstanding the basics here. I'm trying to learn clingo by studying examples I stumble upon online but I'm kind of rushing through it since I have an assignment due tomorrow. If anyone could shed some light it'd be great.
  Thanks.</p>