Common Lisp for mathematicians?

I can very highly recommend the textbook Structure and Interpretation of Computer Programs by Hal Abelson and Gerald Sussman.

The book teaches Scheme, rather than Common Lisp. I think that this is good for several reasons:

  1. Scheme was designed, by the authors of the textbook, to be a good language for teaching.

  2. Scheme is a smaller language than Common Lisp - fewer primitives to memorize.

  3. Scheme doesn't have an object system built in. I think that object systems in programming languages are just confusing for beginners. It's better to learn to program without them, so that you can appreciate when and why it is useful to use objects (chapter 3 of SICP has you build your own object system anyway...)

  4. Scheme is a "Lisp 1" (Common Lisp is a "Lisp 2") which essentially means that there is no distinction between functions and other data. This is natural for a mathematician, who will be used to manipulating functions as data.

  5. The Racket ecosystem provides an easy to set up and easy to use implementation of Scheme.

Common Lisp is a powerful and complex language. If your goal is to learn programming (and good programming style) then I advise you to learn Scheme initially, which will greatly ease your transition into Common Lisp should you require it.

Edit: Here's a comment I wrote on another site when asked for "books that would give you superpowers".


You have good taste.:-) I assume you have tried Practical Common Lisp, which is the book most people recommend these days. I've used it myself, and it is good. Note that though Seibel does not provide a PDF of the book, it is easy to find one on the net if you want. I don't know if you would consider this to be a book for experienced programmers.

I've written some Common Lisp myself, in 2012, and it is an impressive language.

My rather obvious suggestion for people learning programming in general is not actually to read a textbook. It is boring and you get bogged down. (Having said that, Seibel's book is well written, as programming books go.) Instead, try writing some simple code, preferably something that has meaning to you, see how it goes, and use a textbook for reference. I have a math background myself, and I think people with that kind of background tend to focus too much on theory. Don't worry too much about the theory, at least to start with. Just write some code. It is important to use a good environment, though. I'd recommend the usual emacs/SLIME combination.

I'd also recommend talking to people on the forums. #lisp on freenode is a good place to get quick informal help. Stackoverflow is a good place to ask basic, non-specialist CL questions. Not many of the experts hang out there, so if you have very sophisticated questions, other places may be better.

Another option could be to help out in free math software projects like Maxima and Axiom, both of which use CL, I believe. They might be able to find some simple tasks for you, and it would be a good way to learn CL, and do something useful and help the community at the same time. Of course, this assumes you have the time, interest in symbolic computation, and inclination to help.


The classical book of Peter Norvig is now also available on his github page:

https://github.com/norvig/paip-lisp.git