Wednesday, December 28, 2011

First steps in Learning LISP

My Road to Lisp started with an accident. I was looking for reading up on something about Hacker culture. One thing lead to another and before long I was installing a Common Lisp flavor in my machine.

But I am jumping myself here. The story starts when I was looking to read something related to Computer Science fundamentals. Why something? Well, just for the heck of it. To rub an itch, so as to say. I wanted to make a detour from my regular day job and indulge in something which is closer to my passion of technology. So, I started reading up on UNIX and Internet history.

This wonderful book Where the Wizards stay up late transported me to the era when DARPA was funding inter-networking R&D project. The main story had a side plot on what happened in AI Labs at MIT in early 1970s, how Richard Stallman's life took a turn which has had lasting impact on the politics of software and how UNIX gained traction in academics community while other existing systems slowly went into oblivion.

After a while I picked up Tenanbaum's book on MINIX. I was revisiting concepts of process scheduling, memory management, thread management etc while also getting introduced to the debate of monlithic vs micro/modular approach to kernel design. This led me to discover Tenanbaum vs Torvalds debate, discovery about GNU Hurd and again encountering RMS.

Any mention of RMS goes without bringing up concept of Free Software movement and later forking of Open Source movement. This story has its stalwarts, apart from RMS and Torvalds, like Eric S Raymond (ESR) and Paul Graham. I read up on different licenses supporting FSF and OSS, differences between them, the business model of FSF and OSS, how OSS is being marketed and how the latest developments are playing out in field of handheld devices. ESR brought me the joys of Hackers and Painters, The Cathedral & The Bazar and various pieces on hacker culture. Paul Graham had great insights to share through his experiences at Y! Combinator.

Through all this, I kept hearing about Lisp:

  • RMS worked at MIT AI Labs and Lisp was being heavily used there
  • Discovery that there were Lisp Machines built specially for programming in Lisp and that there architecture was different from von Neumann architecture based on which Personal Computer revolution (the story arc of: Altair, Ed Roberts, Bill Gates, Steves - Jobs & Woznaik, IBM, BASIC, DOS, Xerox PARC, Doug Engelbart, Windows, MSFT, Apple, Pirates of the Silicon Valley, Fire in the Valley)
  • RMS's life turned upside down by the blow dealt to hacker culture of MIT by politics of Symbolics and LMI (both companies making Lisp Machines)
  • AI Lab becoming dysfunctional; RMS seeking out to make a free OS to have a development environment which provided full freedom to its user
  • RMS starting to port Emacs from AT&T's licensed UNIX version to a free version
  • Development of Emacs Lisp (a flavor of Lisp) to make Emacs extensible 
  • (Seems after this RMS's energy got directed towards making a kernel for von Neumann architecture machines and thus the emphasis to generate a free development tool chain - compilers, debuggers, editors, etc. - for a UNIX like free kernel; as a result C gained prominence in FSF output)
  • In came AI Winter; funds dried up for AI research and Lisp, already taking a beating from C on the front of OS and app development for PCs, started to lose prominence
  • Paul Graham sets up ViaWeb and a web service (later to be rechristened Yahoo Web Store); which have code written mostly in Lisp, give super performance and have unheard of RAD capabilities
  • Paul Graham becomes a proponent of Lisp and sets out to invent his own flavor (Arc)
  • ESR promotes Lisp; says that even if one is not going to ever use Lisp for production level code, Lisp should still be learnt because its style & power expand your programming thinking for better
  • Discover in TIOBE that Lisp is still in top 10 languages in prevalence
  • Discover Greenspun's Tenth Rule -- which says that all computer languages are ad hoc and bug ridden implementation of a subset of Lisp features
  • Read Golder Escher Bach by Douglas Hofstader - discusses Lisp
  • Read and worked through the Little Schemer - discovered the world of atoms and S-exp
  • Went ahead and installed Emacs for Windows (didn't have an opportunity to setup Linux on personal machine while dealing with my day job), clisp & slime. The tool-chain is now ready.
  • Started reading and working through several Lisp books simultaneously - ended up with seriously following SICP (one of the best CS course books ever written) and Practical Common Lisp
  • Joined Quora and StackOverflow forums on Lisp
  • Got also introduced to Haskell. Started reading Learn You a Haskell for Great Good. Its a pretty impressive book. 
  • Installed Haskell compiler. Soon was writing code in Haskell lexical structure and with tail recursion.
  • Computer crashed. @#$#@!$!@$^%!$@%