Creative Commons License

This work is licenced under a Creative Commons Licence.

User login

Some help in starting to get started with Lisp

I decided the other day, virtually on a whim, to learn lisp: the programmable programming language. I'm not going to explain myself here, but I have found it slightly tricky to know where to start. Unlike some other languages it can be a tad hard to find a good guide and way in which to learn, so I shall just list a few things here.

Firstly, there is an excellent set (so far at least, I have only watched the first one) of lectures recorded by MIT in the 80s, and released under a creative commons licence, that introduce Lisp. They can be found here. They are, I've realised, a little out of date. The language has been added to and altered somewhat since these lectures were recorded over 20 years ago, but they still look like they will be useful.

Secondly, I have discovered this fantastic resource: Practical Common Lisp. This is an introduction to Lisp, and contains useful examples, and I think is what I will be primarily using to teach myself the basics. The entire version is available online, but the page also links to the physical book version if you so desire (I may indulge if I find the electronic version good).

The previously mentioned book recommends setting up "lisp in a box". This however is largely unmaintained, and alternatives are probably a wiser option. It is common amongst Lisp-ers to use Emacs (Emacs was written in Lisp after all); so I decided, whist learning Lisp, to finally learn Emacs too. I did however come across a small problem, after installing Emacs and SLIME (the required Lisp component) that starting SLIME in emacs did not work correctly. I was expecting to type ALT+X and then to type "slime", however when I did so it was telling me that lisp was not found. The solution to this problem is to create the file ~/.emacs (or to append to a pre-existing instance) the following lines:

     (setq inferior-lisp-program "/usr/bin/clisp")
     (add-to-list 'load-path "/usr/share/emacs/site-lisp/slime")
     (require 'slime)

The above paths are correct on my Ubuntu Hardy installation, and seem to be correct for previous Ubuntu versions, but you may need to check for yourself to verify them.

You will see mention of "clisp" above, and in this context, this is effectively an application that starts a Lisp "command line". As a hint, if you experiment a little by running this directly, it may be confusing how to exit correctly. You have to type "(exit)" or "(quit)" or "(bye)" - that is, the brackets are required, and typing "exit" or "quit" will just give you an error.