.code as art.

Some of my favorite bits of code. Have a candidate, email me.

An implementation of positive exponentiation.

  unsigned int ipow(unsigned int a,unsigned int b)
  {
    unsigned int c=1;

    while (b != 0) {
      if (b & 1) 
        c *= a;
      b >>= 1;
      a *= a;
    }

    return c;
  }
  

A classic (not mine) quine:

  ((lambda (x)
      (list x (list (quote quote) x)))
     (quote
        (lambda (x)
          (list x (list (quote quote) x)))))
  

My quine contribution, a ruby quine:

s=%q{s=x;print s.sub(%q{x},%q|%q{|+s+%q|}|)};print s.sub(%q{x},%q|%q{|+s+%q|}|)

There are numerous beautiful connections between e and Π in mathematics, many of which can not properly be understood without the tools of complex analysis. The following is a famous, and my favorite, example of such a connection: