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-15 10:39

Fuck.

int fibarray[MAX_FIBS] = {1,1};

int fib(int n)
{
   return fibarray[n] ? fibarray[n]
                      : fibarray[n] = fib(n-1) + fib(n-2);
}

Name: Anonymous 2008-06-15 11:06

Will fibarray be filled with zeroes in >>12?

Anyway your implementation destroys stack, good job.

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