[Haskell-cafe] Re: speeding up fibonacci with memoizing

marnes mmmaaarrrnnneeesss at gmail.com
Mon Nov 5 21:34:48 EST 2007


  fib :: Integer -> Integer
  fib n = fibaux n 0 1 1
   where
    fibaux :: Integer -> Integer -> Integer -> Integer -> Integer
    fibaux i a b c | i==0 = a
                   | i/=0 = fibaux (i-1) b c (b+c)





More information about the Haskell-Cafe mailing list