title: Comparing first and last element of list with append
body: <p>I'm a bit of a prolog noob thats why i am asking here, i couldn't find the anser else where.</p>
  
  <p>The thing i am trying to do is this function in a different way: </p>
  
  <pre><code>firstlast([H,H]).
  firstlast([F,_|T]):- firstlast([F|T]).
  </code></pre>
  
  <p>it basicly finds out if the first and last element is the same in a list with two or more elements.</p>
  
  <p>Now i want to make this function with append, so instead of recursion just a single call to append.</p>
  
  <pre><code>append([],U,U).
  append([H|T],U,[H|V]) :- append(T,U,V).
  </code></pre>
  
  <p>Example of how it should work:</p>
  
  <pre><code>firslasta([1,2,3,4,1]).
  true.
  
  firstlasta([1,3,4,1,5]).
  false-
  
  firstlasta([2,5,2,3,6,2]).
  true.
  </code></pre>
  
  <p>Any help with this would be greatly appriciated :).</p>