Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Lisp obviously is an advantage for the AI stuff, but it doesn't appear to me that Lisp is any faster than Java, C#, or even C. I am not a master of Lisp, but I find it incredibly difficult to understand the advantage one would get in writing business software in Lisp.

Yet it is considered as a hacker's language.

Why does Paul Graham advocate Lisp? Why did ITA Software choose Lisp over other high-level languages? What value does it have over these languages?

share|improve this question

closed as primarily opinion-based by gnat, Bart van Ingen Schenau, Jim G., MichaelT, GlenH7 Nov 25 '13 at 12:19

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

14  
The line "I don't think Lisp is any faster than Java, C# or as a matter of fact faster than C" is somewhat confusing. C is typically held up as the standard for "fast code because you're programming close to the metal" -- it's the benchmark to beat for just about everything. Now, Java and other GC'd languages can beat it in some contexts, for example speed of memory allocation / cleanup. But, this sentence seems a little backwards nonetheless. –  khedron Oct 4 '10 at 15:11
2  
Lisp is a higher level language than those you mentioned, thus is generally slower. –  segfault Jan 13 '11 at 23:23
3  
@Bo Tian: "higher level language" needs an unambiguous definition. Even if it had one, this sounds like a non-sequitur. (thanks @Mark) –  Mike Dunlavey Jan 14 '11 at 22:50
1  
@BoTian "higher level" does not equal "slower" by default. –  user1249 Jul 15 '12 at 12:54
6  
Lisp exists to show how wrong every other language designer has been. –  Jarrod Roberson Apr 6 '13 at 3:54

17 Answers 17

up vote 62 down vote accepted

There are a few reasons I am working on becoming competent with Common Lisp.

  1. Homoiconic code. This allows structured self-modifying code.
  2. Syntax-aware macros. They allow rewriting of boilerplate code.
  3. Pragmatism. CL is designed to get stuff done by working professionals. Most functional languages aren't, as a rule.
  4. Flexibility. It can do a lot of different things, all at reasonable speeds.
  5. Wartiness. The real world is messy. Pragmatic coding winds up having to either use or invent messy constructs. Common Lisp has sufficient wartiness that it can get stuff done.

Arguably the only real reasons to choose against CL is that the standard libraries are dated.

I will go out on a limb and say that in the general case, syntax should not be an issue to a professional software worker.

share|improve this answer
12  
++ Makes sense, especially the last sentence. –  Mike Dunlavey Oct 4 '10 at 20:01
5  
Syntax can be an issue if it significantly affects readability or writeability. I don't think that's the case for Lisp. A good editor or IDE can do good enough syntax highlighting and paren matching to not be a big deal. –  Matt Olenik Oct 4 '10 at 22:36
1  
Also, I've only used Lisp a little (Common Lisp), and the general feel I got was that #2 was the biggest benefit to Lisp. Maybe I'm thinking in the wrong paradigm, but I don't think I've ever had a situation where self-modifying code was necessary. If you have a specific reason to use it, then yes, but otherwise the macros seem like the real killer feature. Edit: Just realized these are, in fact, the same feature. –  Matt Olenik Oct 4 '10 at 22:37
3  
@Matt: Yep. FWIW, I recently ran into Nemerle, a C#-ish CLR experimental language with macros. nemerle.org. It's worth poking at some point I think, just for the experience. –  Paul Nathan Oct 5 '10 at 4:59

I believe the correct LISP answer is more gnomic. Something like: "If you have to ask, you are not ready."

Then if anyone questions further the correct answer is either "yes" if it's an either/or question or "You are not ready."

share|improve this answer
4  
Paul Graham quotes Louis Armstrong: “If you have to ask what jazz is, you'll never know.” –  Jason Baker Jan 30 '11 at 20:31
6  
+1. Though sometimes phrases like "If you have to ask, you are not ready" make me think that the one who says so simply cannot explain –  superM Aug 24 '12 at 11:13

I like Lisp for its

  • unified, simple and elegant way of representing both code and data.
  • unique point of view, which gives me the crucial 80 bonus IQ points on solving hard problems (with hat tip to Alan Kay)
  • extremely agile, interactive and conversational development environment
  • unprecedented power to create and manipulate abstractions

Programming is fighting complexity. Abstractions are the only effective tool for fighting ever increasing complexity (with our very limited and constant skull size). Managing abstractions with Lisp is like having a genie with n+1 wishes.

share|improve this answer

I think that the Lisp advantage in the AI field that everyone mentions is somewhat a historical accident... Lisp started for/in AI, but it's a general purpose language.

I believe execution speed is not the only important aspect of a language (I did once, though). However, one of the aspects I like about Lisp is that for me, it combines Python and C in one. I can start to code with no declarations and prototype immediately and very quickly (the runtime and the REPL are very important for this). After I have something running, I add type declarations and "optimize" my code, little by little. It is a wonder to press a key in SLIME and watch the machine language generated for the function I'm interested in. In Python, there are no type declarations, so I cannot get more speed, but in C, getting anything done quickly is much more painful. Lisp is very useful in this case.

Having said that, I like Lisp mainly because of macros. When you finally understand what macros can achieve, I think you put up with parentheses easily. Also, editors like Emacs manage parentheses themselves so you don't have to. I admit, however, that I didn't find parentheses all that bad at the beginning, and I know some people just can't stand them. But since the whole purpose of macros is to generate code at compile time, code in Lisp uses a standard data structure, and the parentheses simply are a representation of code as lists, which is necessary to make macros simple to write. I don't know any other language in which you can write little sublanguages to describe your problem better with the ease of Lisp. That is the advantage Paul Graham talks about in "Beating the Averages". It is extreme modularity and conciseness. In Java I have to write a lot of raw text to express a single idea. In Lisp I could write some macros that generate that code automatically, and afterwards just use those. Anyway, you have to understand some examples of this and then judge for yourself. When I "saw" it, I was blown away, and I still think Lisp is the greatest language for this reason alone. I always look for macros in mainstream languages to see if they match the power of Lisp macros but to date I didn't find any. Forth is a close second.

I'll finish with a couple of criticisms, in relation to Business Software:

  1. Business Software needs libraries, and good ones, and Lisp is not good at this. I usually don't need them, but when I do, I have to choose from a little selection of incomplete software that a few people uses. I should contribute to fix this, I guess...

  2. Business Software is usually built by large groups of people, and I think communication can be impeded with macros, since they basically change the language. A lot of programmers are more comfortable detecting certain patterns in code, even if the program text is longer and more repetitive. I suppose at ITA they have some rules regarding macros or they have a huge macro library that makes collaboration easy (or, more simply, all programmers are Lisp experts).

share|improve this answer
3  
Try clojure, it is a lisp on the JVM. So by using the JVM you can use all the java stuff. –  Zachary K Feb 15 '11 at 12:37

I'll interpret "Lisp" as "Common Lisp"; I've no doubt other answers will say "Scheme". (Hint: Lisp's a family of languages.)

What's "faster" mean? In terms of time taken to run a benchmark, no, it's not faster than C (but it can be).

"Fast" in terms of how long does it take J Random Hacker to write up a working program, or fix a bug in large software system? Almost certainly.

As for this hacker, I use it because I want to write code, not boilerplate. I want to write something once, and not continually repeat myself. And I want to interact with the program while I write it.

share|improve this answer
4  
@Mark: I think you're describing Emacs. –  Ferruccio Jan 30 '11 at 20:52
2  
@Mark C: Well, you do have to highlight the region and then M-x eval-region (or eval-buffer), but that's all. –  Frank Shearar Jan 31 '11 at 9:39
1  
@MarkC: Also, if you're in the scratch buffer, you can just write your function and press C-j (which is morally equivalent to enter) and it will take effect immediately. –  Tikhon Jelvis Dec 23 '11 at 9:43

I don't like Lisp.

(I do like many of the concepts it uses, how it makes powerful techniques available natively, and so on.

But I've never been convinced to actually go use it, ((even though several people have tried) because the benefits of the language can be achieved with other programming languages (some directly, some indirectly), so there isn't enough benefit to get me to spend the time learning it and putting up with the horrific syntax.)))

But yeah, for reasons that some people like it, check these Stack Overflow questions:

There's probably a few more in the related questions for those too.

share|improve this answer
23  
"Putting up with the horrific syntax". Maybe it's just too long since I was a Lisp newbie, but the simplicity and regularity of Lisp syntax is a huge feature, since that's what it makes it possible for me to extend Lisp in itself. I can add custom iterators, I can add new "with-xxx" scope constructs which automatically clean up after themselves so the developer doesn't have to, etc. The syntax is a feature, not a bug. –  khedron Oct 4 '10 at 14:18
19  
+1 for the nested use of parentheses in this answer. –  Dan Dyer Oct 4 '10 at 19:32
7  
Okay, how do you get the benefits of the macro system? How many languages allow you to build an object-oriented extension to them in one reasonably short chapter (Paul Graham, "On Lisp"). –  David Thornley Oct 14 '10 at 19:37
6  
The syntax isn't any more horrific than other languages. I've found that the parentheses just visually "disappear" after a while. With good indentation, the code is easily readable. –  Barry Brown Nov 12 '10 at 19:46
5  
But having the ability to easily move between S-exps seems huge... Then on the subject of parentheses, I like the following quote: Parentheses? What parentheses? I haven't noticed any parentheses since my first month of Lisp programming. I like to ask people who complain about parentheses in Lisp if they are bothered by all the spaces between words in a newspaper" - Ken Tilton –  Cedric Martin Oct 26 '11 at 23:32

I have had a knee-jerk reaction to Scheme in the past, but now I am ready to give Lisp (Clojure actually) a shot.

You see, over the years I picked up bits of languages like Java, C#, C++, Python, and things are no longer challenging.

Clojure has many promises, appears to be very clean, and can solve many real-world problems. A strong case for a clean language like Clojure is the advent of multi-core computers.

Yay LISP!

EDIT: ITA Software was founded by MIT grads, and Scheme/Lisp was the only language that many of the MIT grads learned. To be fair though, one can hot-swap Lisp algorithms on a running production system, which is a huge plus.

share|improve this answer
7  
Re: Things are no longer challenging---give Haskell a go and let us know what you think. Also, you can always try to learn some INTERCAL for a change! –  Mark C Oct 4 '10 at 15:25
2  
@Mark C, sorry but I am not touching INTERCAL. Challenge is not the only criteria; it has to be able to solve real problems fast as well. At least Haskell is used and loved by many. –  Job Oct 14 '10 at 18:21
1  
Updating running code (carefully!) on a production server is one of the joys of Lisp, yes. Python, at least when I was playing with it, did not do this well; you'd have to manually recompile all functions/methods which referred to your changes, while all Common Lisp implementations handle that for you. I use that same power for development: write, test something, edit, test -- no compile loop, and you can take your interactive tests & turn them into unit tests if you wish. –  khedron Nov 28 '11 at 20:58

The logical answers have all been covered, so I'll add my personal one.

I like lisp because it's an excellent medium for expressing my thoughts. The predicate for my favorite language is "If I could pick anything to express ideas in, what would it be?". Currently it's Lisp* (Scheme to be specific), to the point that I find myself writing out programming notes in it. As in IRL, paper and pen notes. Even when I'm thinking about programs I need to implement in PHP or Ruby or Python.

This isn't a trick I taught myself, or something I do for nerd cred (no one gets to see the inside my notebook anyway), it's just that Lisp is so much more natural for me to think in than any of the alternatives, and any language that resonates with you that deeply is one you treasure.

*Just as a footnote though, Haskell is closing the gap pretty quickly as I learn more of it.

share|improve this answer

"Faster" isn't a simple thing to measure -- it really depends on which aspect you're benchmarking. Depending on the task and the Lisp implementation, speeds can approach C. Look at the Great Benchmarking Shoot-Out to dive for details. The SBCL implementation of Lisp is on par with Java 6 Server, and significantly faster than Ruby or Python.

But, pure speed isn't the main reason to choose a programming language -- if it was, we'd all be programming in Assembler still, right? For me, the daily joy of Lisp is that the code is compiled, but I don't have to take down the application, recompile everything, and then start running from scratch. Instead, I can change a single function and that change will take effect everywhere, and I can immediately see the effect in my application. Moreover, that very quick "write, test, write more, test more" approach makes it much easier to test immediately up front while writing the code (and then you can turn those interactive probes into unit tests later on).

Imagine writing email where after every line, you had to hit a button to compile your email output to the screen before continuing your thought. That's what writing in Java or another language like that is for me. Sometimes there's a reason to do that, and I like Java fine, but Lisp is just more responsive, and it's easier to get work done.

share|improve this answer

Paul Graham sort of answers this question himself in What Made Lisp Different

Keep in mind he used it for his startup during the mid 90's, so python and ruby weren't really mature at that point (or maybe not even born).

Lisp basically has all the advantages of dynamic languages, and I think for most of today's web apps, python and ruby are pretty awesome, and they have the advantage of frameworks and documentation and vibrant communities.

The killer feature is probably that the entire program is made of expressions. This means you can sort of pass around blocks of code to functions (or macros..), because a block of code is nothing more than an expression.

Python doesn't exactly have this feature; you'd have to define functions and pass them around. Ruby seems to have blocks, perhaps it's somewhat limited compared to what lisp can do (I'm not sure).

share|improve this answer

The issue is power. Power = Work (program functionality) / Time

"We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp."

-- Guy Steele, Java spec co-author

Plot some kind of curve between C++ and Java. Keep going, and at some point along the line you'll find Lisp.

share|improve this answer
2  
The problem here is that you lose a lot of C++ functionality going to Java, but pick it up again (often in improved form) when going to Lisp. –  David Thornley Jan 13 '11 at 23:02

I'm learning lisp (newLisp) for a couple of reasons.

Reason Number One: Lisp makes me think differently, which makes me a better Ruby coder.

It seems very awkward to do things certain ways in Lisp, for example nested iteration to go through multiple lists. So it forces me to use other things, like map. My favorite language, Ruby, has the same map method, but I don't always use it because it's unfamiliar: I learned to do things using poor technique, and when the language supports that technique I continue to use it.

Reason Number Two: Lisp is practical and has good modern libraries.

There's a very nice, lightweight web framework for newLisp called dragonfly. This allows me to use newLisp code instead of PHP for some tasks. I don't really like PHP, and newLisp seems more fun for this specific task than Ruby.

Reason Number Three: Lisp is syntactically and conceptually consistent.

For me, this is the big difference between Ruby and Python, consistency.

share|improve this answer

The thing that I like about Lisp is that it transcends paradigms. Some people will say that lisp is functional, others will say it's declarative, and others will say it's multiparadigm. I think all of these miss the point. When you use lisp, paradigm is no longer a constraint.

Want objects? You can have them. Want functional programming? You can have it. Want prolog-style logic programming? Write some macros. Want SQL-style declarative programming? Go for it. Want to use some paradigm that hasn't been invented yet? I'm confident it can be done in lisp.

Aside from FORTH-like languages, I have yet to see another language offer this level of flexibility.

share|improve this answer

Can you say "Brand Loyalty"?

I started in Fortran. I loved it.

I switched to Lisp. At first I hated it. Then I learned to love it, and hate Fortran.

Later Pascal, C, C++, various assemblers, C#. (Actually I don't love C#.)

I guess I'm fickle?

share|improve this answer
1  
Mein Führer, I can CODE! –  user1249 Jan 30 '11 at 20:03
1  
@Thorbjørn: Easy for You to say, with a European keyboard :) –  Mike Dunlavey Jan 30 '11 at 20:52

When lisp was created they started from Math not CS (which didn't really exist yet). And the lisp team got some things REALLY right. Lisp had garbage collection in 1960 or so! They really did a great job.

I think this song covers it: http://www.youtube.cf/watch?v=5-OjTPj7K54&feature=related

share|improve this answer

I don't actually do LISP. But the place I work at does Finite Elements with millions of lines of mainly Fortran. The guy here whom I most respect about computing stuff (codes Computation Fluid Mech) thinks the ideal combination is LISP on the outside (mainly because you avoid messy problems with memory management), and Fortran for the low level algorithms (Fortran is best for exploiting the vector capabilities of SSE/AVX, and we think this lead is unlikely to close).

share|improve this answer

A big draw is the community. Lisp has had a draw for the most ambitious and bright developers since the language was invented. Wherever researchers are trying to solve problems that have never been solved you are likely to find Lisp, as in AI research, computer vision, planning, knowlege representation, complex heuristic optimization. The language lends itself to solving problems both from the bottom up and the top down at the same time, which seems to help in confronting the hairiest challenges.

The exensible syntax via macros means that there is seldom a need to extend the language definition. Much of what would require a language extension in a more restricted language is just a macro away with Lisp. So Lisp programmers are free to make use of newly invented language concepts without a new language standard and without necessarily a real speed penalty. On a basic level, reams of boilerplate code are made unnecessary by small extensions. Whole new ideas in control flow, like Prolog style unification, are implemented efficiently and compactly as extensions.

The OOP system, CLOS, is in a class of its own in terms of flexibility. It is very difficult to go back to rudimentary C++/Java/C# OOP after getting a taste. Gof5 design patterns become unnecessary as they can be expressed simply and directly.

The language has had no single corporate owner and no single definitive implementation, though it does have an Ansi standard with many conforming implementations. Major new implementations come along every decade and the old ones are still quite active. Experts can plan to use their specialized knowledge for a long time to come. This does cause some anarchistic friction and community fragmentation, but it also means the carpet cannot be pulled out and the language can't become moribund for corporate or project political reasons. There are always multiple commercial and open source implementations being worked on. The more performance focused ones regularly benchmark within a 2x factor of the very fastest, heavily funded imperative language implementations.

The achilles heel of early lisp commercialization was memory footprint to accomodate both the type safety features of the language and the advanced software development environments they included, with incredible features like full online documentation including graphics. A 64MB Symbolics Lisp Machine was not viable cost wise against an 8MB Sun workstation. Today RAM prices have collapsed and there is tremendous interest in the Lisp languages especially considering that the mainstream Java, C#, PHP languages today have advanced only minimally over those of 30 years ago.

There are modern languages now in competition with Lisp for mindshare with intelligent developers: Python, Lua, Erlang, Haskell, OCaML. But none offers the same mix of maturity, adaptibility, multiple standards compliant implementations and speed.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.