Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Fibs in C

Name: Anonymous 2008-06-14 10:50

How can you write the Haskell fibs in C? I mean the

fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

fibs.

Name: Anonymous 2008-06-16 14:57

int fib(int i) {
  if(i<2)
    return i;
  else
    return fib(i-1) + fib(i-2);
}

Sorry to break up the trolling, but this is what I would do.

Name: Anonymous 2008-06-16 15:08

>>35
That is not memoizing.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List