I’ve been wanting to learn a Lisp for quite some time now. And by learn, I mean “be able to write a sizeable program in”. While I consider myself a language buff, the truth is that I only have real experience in a few languages: Java, C++, Python and a smattering of assembler. In any of those I would be able to write a medium size program without taking too much time or learning too much on the job. I have about 5 weeks of summer left and for 3.5 of those weeks, I have practically nothing to do. So I’ve decided to buckle down and learn some Lisp.
Choosing a Lisp
Before I got down to actually learning Lisp, I had to make a choice as to which dialect of the language I should actually use. I’ve used a bit of Scheme before (mostly as a result of getting halfway through SICP) and though I liked it, public opinion was that Common Lisp was more suited for real world development. And since I did plan on doing real world development, Common Lisp seemed the better choice. There was also Clojure which I could have considered. I really didn’t consider it because Common Lisp was good enough and it had both excellent tools and good books. I should also mention Paul Graham’s Arc language which is currently under heavy development. Arc development is going somewhat slow (but with good reason) and if Arc was ready, I would definitely have considered it. but I really wanted something that would give me a good environment today and Common Lisp gave me what I wanted
Getting Lisp (and tools)
Languages like Python, Perl and Ruby all have a single ‘reference implementation’ and some have alternate implementations (like Jython, JRuby). Common Lisp is an ANSI standard with a number of standards-compliant implementation from various vendors. There are a number of good open source Common Lisp implementations (like GNU CLISP and Steel Bank Common Lisp) as well as proprietary ones like Allegro and LispWorks. I’ve decided to use the Steel Bank Common Lisp. It’s a branch off the older Carnegie Mellon Common Lisp. It runs on a bunch of platforms and compiles down to high performance native code. The native compiler (which I’ve heard good things about) was the main reason for choosing it, plus I think the name is cool.
If you’re serious about developing in Lisp on a Linux box (as I am), your IDE of choice is almost certainly Emacs with SLIME mode. SLIME stands for Superior Lisp Interaction Mode for Emacs and it really deserves it’s name. Not only does it provide solid editing features like highlighting and indentation, it also integrates very well with whatever Lisp runtime you’re using. It allows you to dynamically evaluate definitions and expressions and send them to a Lisp process where you can interact with your code just like you would with any modern dynamic language. SLIME also provides excellent debugging tools and they’ve already proved quite useful, even though I’ve only scratched the surface.
Finding Reading Material
The internet is a great place to find information, but when it comes to learning something seriously, I really like to have a proper book, or at least a well organized tutorial. Luckily for Common Lisp there are at least two great free books. The introductory level book is Practical Common Lisp, which I’m currently using. It’s a great book for people who already have a good idea of programming and want to learn Lisp. I like to think of it as a sort of ‘Dive into Python’ but for Lisp. I’ll put up a more thorough review once I progress a bit more.
The second book I’m going to start is On Lisp by Paul Graham. It’s for people who already have a good idea of Lisp programming and want to learn more advanced techniques. I read the first chapter (which is a rehash of basic Lisp) but it makes more sense to get used to Lisp first before I try for advanced stuff.
Practice makes perfect
Computer science has a lot of theory behind it, but when it comes to something like learning a new language or framework, the only way to get good is to practice. I’m not at the point where I can write large scale programs in Lisp yet and till then I need to practice. I’ve found a really great web page that has 99 problems to be solved in Lisp which vary in difficulty and cover a large range of the things you can do in Lisp. I’m at number 20 at the moment and trying to keep a good pace.
I eventually want to write some server-end software in Lisp, I’m contemplating some sort of content management system. I’d like to get a start on it before summer ends, but right now I’m more concerned about just learning the ropes. I hope to work my way through Practical Common Lisp by the end of next week and start On Lisp after that. If you guys know of any other good resources or small sized Lisp projects I could get involved in, do let me know. And I’ll have more updates on my Lisp adventures soon.