title: How to define a predicate in prolog
body: <p>I am new to Prolog and I have so far learned how to define a predicate in a file and the run the interpreter to use it. But I would like to know if there is a way to define the predicate at the ?- prompt so that I don't have to switch back and forth.</p>
  
  <p>the way I am doing it now is like this</p>
  
  <p>file defs.pl:</p>
  
  <pre><code>adjacent(1,2).
  adjacent(1,3).
  </code></pre>
  
  <p>in the prolog interpreter:</p>
  
  <pre><code>?- consult('defs.pl').
  % defs.pl compiled 0.00 sec, 122 bytes
  true.
  ?- adjacent(1,2).
  true.
  </code></pre>
  
  <p>EDIT
  maybe I meant how to define 'facts' I'm not sure.</p>