December 29, 2005

Conjure our spirits in a magical language called Lisp”

Even the first 10 minutes of the 1st lecture of the MIT lectures on Structure and Interpretation of Computer Programs” is amazing.

In Computer Science, we’re in the business of formalizing ‘how to’ imperative knowledge” aka process.”

In the first 5 minutes, I’ve already implemented my own square root function, which works surprisingly well:

class Program {
  static double MySquareRoot(double x) {
    double margin = 0.10;
    double g = x / 2.0;
    while( System.Math.Abs(g * g - x) > margin ) {
      g = (g + x / g) / 2.0;
    return g;

  static void Main(string[] args) {
    double x = 44523.0;
    System.Console.WriteLine("sqrt({0})= {1}", x, System.Math.Sqrt(x));
    System.Console.WriteLine("MySquareRoot({0})= {1}", x, MySquareRoot(x));

I can’t possibly believe that I would’ve understood the implications of the lecture as a freshman, but now, it’s like Moses and the stone tablets. Priceless.

[via Joel Spolsky]