I picked up a LISP book at a garage sale the other day and was just wondering if it was worth spending some time on.
-
10The best thing I ever did was stumble across LISP. It opened my eyes in a 'riding a bike' kind of way and it's influence is there in everything I've programmed since. Happy reading! – deau Oct 23 '09 at 19:50
-
1A lot of related answers are here: http://programmers.stackexchange.com/q/55284/15028 – TCSGrad Apr 15 '13 at 03:50
14 Answers
Yes. I'll stick to Common Lisp, here, though Scheme is also a superb language that has a lot to recommend it.
In Common Lisp, you have a largish multi-paradigm language that provides some things that either don't exist widely outside the Lisp family of languages, or are limited to CL and even more obscure/niche languages.
The first feature, which you can get in one way or another from CL, Scheme and quite a few other dialects, is a real macro system.
I say "real" because the system is much more complete, flexible and reliable than, say, C preprocessor macros. It's extremely difficult to get CPP macros to do even simple things (like swapping the values of two variables, or making a foreach
construct) in a reliable fashion, but these are trivial with Lisp macros. This turns out to be a very powerful tool for introducing new abstractions and dispensing with "boilerplate" code.
The second feature, which is effectively limited to Common Lisp, is CLOS, the Common Lisp Object System. Despite the name, it's not a conventional OO system like that of Java with methods being part of a class's definition. Instead, it provides polymorphism through "generic functions" which are what methods are attached to, and by default allow you to do multiple dispatch.
I vastly prefer CLOS to the more usual approach to object orientation, as it makes a number of "patterns" (like the Visitor pattern) completely unneccessary and because extension of existing generic functions is so easy; others loathe it because it takes an extremely cavalier approach to encapsulation and because extension of generic functions becomes arguably too easy. Either way, CLOS is different enough that I think it's worth learning just for the different perspective it provides.
The third feature, which is available outside of Lisp but still fantastic if you've never experienced it before is dynamic, interactive programming. CL debuggers tend to be extremely powerful tools, and CL provides for dynamic definition and redefinition of functions, classes and methods, all of which dramatically improves one's ability to explore a problem, test solutions of that problem and its subproblems, and finally put together a program that works correctly and efficiently.
Lastly, for a lot of classes of problems, Lisp is a great practical language. It provides good performance (usually not as fast as C, but dramatically faster than most "scripting languages"), safety, automatic memory management, a decent "standard library" of functions and tremendous opportnities for easy extension.

- 9,781
- 1
- 43
- 70
-
1It's the interactive nature of programming Lisp which I enjoy most. I take advantage of this every day. – Michael H. Oct 23 '09 at 17:58
-
I've been reading the SICP book on-line, I believed that Scheme was just an implementation of LISP – David Oct 23 '09 at 18:16
-
Technically Common Lisp and Scheme are both dialects of McCarthy's LISP. Today though, "LISP" is shorthand for the former. – grettke Oct 23 '09 at 23:29
-
7
It is worth learning for "mind-expansion" purposes but not so popular for building apps these days.
However, it is powerful, and mature, and there are fast and free compilers out there. So there is no reason not to choose it for a program if you like.
The way in which Lisp treats data structures and program structures the same offers amazing power which is worth understanding.
Its history is fascinating and it has shaped the world of computer science.
Be sure to check out Ableson and Sussman's Structure and Interpretation of Computer Programs at MIT OpenCourseware

- 269
- 4
- 11

- 25,416
- 6
- 48
- 54
-
5CMUCL isn't updated as much any more. I'd stick with SBCL, unless there's a reason to use the older one. – Ken Oct 23 '09 at 17:29
-
3That's not really true. SBCL is more active than CMUCL, but CMUCL is actively maintained. Just three weeks ago had with CMUCL 20a a new major release. CMUCL also has monthly snapshot releases. – Rainer Joswig Oct 23 '09 at 22:46
-
2What exactly is the difference between "CMUCL isn't updated as much" and "SBCL is more active"? :-) You say, (< a b), I say (> b a)... – Ken Nov 24 '09 at 21:36
Depends on the book. Which book?
Common Lisp is worth learning today because it's one of the few languages that pretty much "does everything". If there's some mainstream or obscure programming idiom or technique, odds are Common Lisp has it already in some form. About the only thing CL lacks is continuations (many argue it doesn't need them, but that's not helpful if you want to explore them).
Anyone spending any serious time writing in Common Lisp will come out Changed in some way, typically for the better, IMHO.
Even if you can't carry all of the Lispy concepts you learn and use in to other environments, knowing about them and how they work is still useful.

- 115,893
- 19
- 128
- 203
-
Well, CL _has_ delimited continuations. There are even web-frameworks built around them. – dmitry_vk Oct 23 '09 at 17:36
Good programmers expose themselves to as many different programming paradigms as they can - not as many programming languages as they can.
The LISP family (there are several variants) is very worth while getting to know. Your objective should be getting your head wraped around functional programming and the lambda calculus - the paradigm that LISP is based on. Focus less on becomming an "ace" LISP programmer (that could take years).
If you find functional programming "flips your switch", try having a look at PROLOG too - here the paradigm is based on evaluation of Horn Clauses (predicate logic).
I may have spent the last 20 years earning a living as a COBOL programmer (OMG - they still have those!), but I think I am a better programmer because of the time spent learning what LISP, and a number of other programming languages were really all about.
Have a blast...

- 16,670
- 2
- 39
- 60
Here's a Google Tech talk worth watching about a company currently producing large, complex software for the airline industry in Common Lisp:
Lisp for High-Performance Transaction Processing (The video is now unavailable. Here's some note by Zach Beane.)
Other topics are mentioned in that video, including Clojure, a new variant of Lisp for the JVM (some work is now being done to develop Clojure for the CLR too, but that is not as far along), which is worth checking out for the way it addresses concurrency issues. See the Clojure site at:
and, in particular at first, check out the link in the upper right on that page to some excellent Screencasts with overviews of the concurrency issues and Clojure features.
If you get interested in Lisp, and the book you found is not that great (I have an old one myself that didn't do much for me), Paul Graham's book On Lisp is available free at http://www.paulgraham.com/onlisp.html and is very good. The general Lisp idea is the same for Common Lisp or Scheme or Emacs Lisp or Clojure, but the specifics will be different - so keep that in mind if reading Graham's book, which focuses mostly on Common Lisp (with some mentions of Scheme specifics.) On Lisp is probably not the best beginner book, but it's worth going through it and just skimming over specifics you're not ready to follow in detail yet to see what is there, particularly with regard to macros, which On Lisp really explores.
One benefit of Lisp is that you develop an appreciation for prefix and wonder why everyone else in the world doesn't us it too (like with Latex
or vim
)
+ 1 2 3 4 5 6 7 8 9
is much easier to code/edit/paste than
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9

- 16,318
- 29
- 119
- 199
-
2efficient copy-paste is actually an aspect I never thought of ;-) But how about "(1 to:9) sum" – blabla999 Dec 12 '11 at 22:19
-
2@blabla999 I was thinking more in practical terms, like a calculator. I don't understand why humanity didn't go "wait a minute, wouldn't it make sense to make the plus operator somehow apply to everything that follows?" – puk Dec 12 '11 at 22:32
See this question, and especially the third answer, the one that explains that Lisp is good for solving complicated problems, those problems that are hard to decompose into more manageable modules if you were to try to solve them in another language. In other words, if you are keen on exploring ways to solve convoluted problems, that involve, let's say Natural Language Processing, or Knowledge Aggregation... then, yes, Lisp might just be useful to you.
Learn lisp to learn about macros, and that code is data, and to learn that you can reach enlightenment w/o the self-flagellation of C++.
Learn Common Lisp to learn about reader macros and compiler macros. I don't know any other language that has them.
Learn scheme for continuations.
Learn Clojure because it's going to make Java obsolete :-)

- 2,616
- 1
- 16
- 20
-
32016 now and Java is still going strong while Clojure remains obscure... will revist this again in 7 years – redspidermkv Jan 29 '16 at 11:21
It (Common Lisp) is still heavily used by academics working in Artificial Intelligence. Scheme is a Lisp-like language used by many (most?) CS departments as well. Personally I think learning Lisp is worthwhile whether or not you end up using it. It's a classic language that we've learned a great deal from over time.

- 97,721
- 20
- 209
- 280
-
Can you give some examples for Common Lisp? The only people I know are the ones working with Kevin Knight at USC/Information Sciences Institute. – Nathan Shively-Sanders Oct 23 '09 at 17:22
-
Gordon Novak at UT uses Lisp in all but the two entry level classes he teaches (which the curriculum specifies Java for): http://www.cs.utexas.edu/~novak/ – Sam Harwell Oct 23 '09 at 17:32
Learning LISP is a good way to learn functional programming effectively, and is often used as an introductory language for undergraduate students. Many people feel that Structure and Interpretation of Computer Programs, which uses the Scheme dialect of Lisp, is a book that should be on every programmers shelf.
Paul Graham has been a big proponent of Lisp, and in his book, Hackers and Painters, he describes how he used the power of Lisp to dominate the competition in creating ViaWeb for Yahoo Stores.
Elsewhere, I've seen Lisp dialects used prominently in the aerospace industry, as scripting tools for integration frameworks like Comet, and AML. Lisp will always be tied to the early AI experiments in the 1950's.

- 6,337
- 11
- 51
- 73
As other have alluded to, Lisp isn't that popular anymore for general programming, and it definitely (IMO) has some major problems for writing real systems in, but of course others disagree (for instance much of ITA's software is written in Lisp, and they make crazy bank).
Even if you never write a 'real' program in Lisp, it is absolutely worth learning. There are many programming techniques originally pioneered in Lisp that, knowing them, will help you write better code in Python, Perl, Ruby, ML, Haskell, and even C++. For instance, check out Higher Order Perl, which shows how to do all kinds of amazing tricks in Perl; to quote the introduction "Instead of telling you how wonderful Lisp is, I will tell you how wonderful Perl is, and in the end you will not have to know any Lisp, but you will know a lot more about Perl. [...] Then you can stop writing C programs in Perl. I think you will find it to be a nice change. Perl is much better at being Perl than it is at being a slow version of C."
And there are some great books out there that use Lisp, and it will be easier to understand them if you know the language - SICP, Norvig's Paradigms of Artificial Intelligence Programming, and The Reasoned Schemer all come to mind as must-reads.

- 8,215
- 2
- 37
- 47
Some people here are recommending Clojure. While I would say that Lisp in general is good, I would caution against Clojure, at least for beginners. This is not out of any difficulty using Clojure, just in the fact that Clojure is gratuitously inconsistent with Common Lisp and Scheme. If you want JVM integration, use Armed Bear Common Lisp: https://common-lisp.net/project/armedbear/ , though for general use, I would recommend Steel Bank Common Lisp: http://www.sbcl.org/

- 3,695
- 16
- 31

- 881
- 6
- 5
This is like questioning if "it's worth to learn C these days of web programming?". Only you can decide if it's worth. What you have to ask yourself is: what am I trying to achieve reading the book?
Learning new languages sometimes aren't useful in the practical sense of things (maybe you're aren't going to use LISP ever in your life), but in the long term it's going to be useful because of the knowledge acquired by different paradigms you aren't too familiar with - and you could use some of you learned in what you already use today.

- 10,924
- 1
- 30
- 38
-
3I'd emphasize the "sometimes" in your second paragraph. Learning new languages *sometimes* isn't useful in the practical sense of things, but sometimes it *is* quite useful. I find that when I learn a new language I frequently start to see potential uses for it in places I wouldn't have expected. Acquiring knowledge of different paradigms and gaining skill in using different tools (including different languages) is fundamentally a very **practical** skill for a modern software engineer. – Daniel Pryden Oct 23 '09 at 17:28
-
What I said about practical is that sometimes people want to learn other languages as "silver bullets" to a lot of problems we have in development, like "I'm going to learn this language in all projects I have and it's going to solve everything", and maybe LISP isn't going to be this way, maybe he's not ever going to write a single line in it. But what he learned while reading LISP could help him solving problems in other areas in his career... the same POV as yours. Sorry if I haven't been more clear, I'm trying to suck less every day with my english skills. :) – GmonC Oct 23 '09 at 17:39
It's been awhile since university, but after I took a 3rd year CS course that required learning Lisp and writing Lisp programs, writing and thinking recursively was a snap. Not that I had problems with recursion before the course, but afterwards, it was 2nd nature. I also used CLOS in the course (University of Toronto), but it was so long ago, I barely remember what I did.

- 5,802
- 12
- 54
- 76
-
The AI course at York had a logic programming course as a prerequisite, and that course was LISP and Prolog (The AI course ended up being Java and Prolog, but other semesters had been LISP). That was not soooo long ago (about 6 years). – FrustratedWithFormsDesigner Oct 24 '09 at 21:53