title: Prolog; try to make fibonacci more effective?
body: <p>This logic programming is really making a lap dance on my imperative programming skills. This is homework, so please just don't drop me the answer. This is what I have:</p>
  
  <pre><code>fibo(N,1) :-
     N &lt; 2,
     !. 
  fibo(N,R) :-
     N1 is N-1,
     N2 is N-2,
     fibo(N1,R1),
     fibo(N2,R2),
     R is R1+R2.
  </code></pre>
  
  <p>I'm suppose to make another function that looks like this; <code>fib(N,Value,LastValue)</code>. 
  <code>N</code> is the n'th number, and value is the return value. I don't understand how I can rewrite this using accumulation. And since it counts backwards I don't see how it can "know" a last value before it calculates anything. :s Any input is appreciated.</p>