# Common Lisp for mathematicians?

I am interested in learning Common Lisp. There seems to be a lot of material either for (experienced) programmers, or for people with no background, in programming or in mathematics. I was wondering if there exists an introduction to lisp for mathematicians with no (or very little) experience in programming altogether? Both the theoretical side of the language and the practical side interest me.

-
I'm interested in that, too. Also, have you had a look at [Haskell](en.wikipedia.org/wiki/Haskell_(programming_language)? (Just as a tip in case you didn't – I thought this is also a good programming language candidate for a mathematician.) –  k.stm Jan 23 '13 at 12:50

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".

-
I numbered my list 0, 1, 2 ... (following good programming practice) but the software seems to have changed it to 1, 2, 3 ...! More proof that M.SE is hostile to computer scientists... –  Chris Taylor Jan 23 '13 at 12:59
+1 To counter the hostility. –  Michael Greinecker Jan 23 '13 at 12:59
$0 \notin ℕ$, would you consider the transition from Scheme to Common Lisp a small one? It seems like the languages are still quite different for being dialects. –  k.stm Jan 23 '13 at 13:05
I think that the two transitions "nothing to Scheme" and "Scheme to Common Lisp" are, taken together, smaller than the transition "nothing to Common Lisp". –  Chris Taylor Jan 23 '13 at 13:14
Thanks! Great advice. Before I read your answer, I was recommended `Common lisp: a gentle introduction to symobolic computation' by Touretzky. Any thoughts on this perhaps? –  Michael Parsons Jan 23 '13 at 14:57

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.

-