struct Z {T R,I;};
Z m(Z l,Z r){return{l.R*r.R+5*l.I*r.I,l.R*r.I+l.I*r.R};}
Z s(Z l,Z r){return{l.R-r.R,l.I-r.I};}
Z x(Z e, T n){Z r={1,0};for(;n;n>>=1){if(n&0x1)r=m(r,e);e=m(e,e);}return r;}
T f(T n){Z p={1,1},_=s(x(p,n),x(s({2,0},p),n));return _.I/(1<<n);}
// The entry point to our program
int main(
int argc, // The number of arguments to command-line binary (unused)
char* argv[] // An array of char* arguments to command-line binary (unused)
) {
// The beginning of our program
// Execute the following interior code 15 times
for (int i=0; i<15; i++) {
// Evaluate f at every integral value along the interval [0, 15).
// "%d" signifies the result will be interpreted as a signed integer.
// A space is included following the "format string" to provide a
// neatly formatted output
printf("%d ", f(i));
}
// End of interior code section
// Return a success code to the operating system
return 0;
Whats wrong with haskell? lol I find it very a compact and concise useful language. There's a few great compilers out there for haskell too, such that one needn't worry about optimisation. For example,