title: Prolog, X before Y in a List
body: <p>I am having trouble understanding prolog, I have to find if X is before Y in a list.</p>
  
  <p>so I have a base case with an empty list</p>
  
  <pre><code>before(X, Y, [ ]).
  </code></pre>
  
  <p>Now I know that I want to check the index of X and the index of Y in List and if <code>indexX &lt; indexY</code> I want to have a success. </p>
  
  <p>Could someone explain a simple way to do this? </p>