Lisp is a Chameleon
paulgraham.com
paulgraham.com
I'd say that's a pretty bad analogy. Chameleons are pretty good at camouflaging themselves, but they're really not very adaptable. I'd say that chameleons are the animal equivalent to FORTRAN -- they can look like anything, but they haven't really changed.
If you want a biological example of being highly adaptable, go with bacteria.
Perhaps it should be said that, like a chameleon, Lisp has remained pretty well hidden against the background of current languages.
A-list blogger Robert Scoble took notice of Scheme-based http://ourdoings.com/ and has been using it:
http://friendfeed.com/scobleizer?service=feed&serviceid=...
And it got a glowing review by Mike Fruchter:
http://www.louisgray.com/live/2009/01/our-doings-you-upload-...
Notice that the first words used to describe it, "simple and unique" also describe the language it's written in. Programming language affects programmer thinking.
Selection for Social Signalling Drives the Evolution of Chameleon Colour Change http://biology.plosjournals.org/perlserv/?request=get-docume...
Chameleon. Both the real thing and the metaphor are about change in appearance to become more "socially" acceptable.
Has Lisp done it the way Madonna has done it - always looking hip?
Fortran while looking newer hasn't outgrown as far as I know its original purpose - numeric computation, while Lisp has been modified to be a great tool in many dynamically changing fields.
It's interesting to see that while Lisp is superior in many ways, it's never been widely adopted. Why is that? I'm pretty sure it's not only because of pointy haired bosses, after all they take their cues from the fancy trade rags that are written by people that would at least know about the existence of Lisp. PHP reached a wide audience without the backing of a large corporation, so that argument is probably stale.
I can think of a couple of reasons:
- It's different. The syntax of Lisp is unlike any other language, which might turn people off.
- The Lisp community is not very beginner-friendly. Since we all start out as beginners, there will be no experts if there are no beginners.
- It's fragmented. There has been a history of a number of different dialects that are almost but not quite compatible. This might be a turn-off for people actually wanting to use Lisp for production systems where stability and maintenance of the distro is paramount.
- It's hard. "Lisp is the only language where you spend more time thinking than writing code" - I can't remember where the quote is from, but probably Stallmann, Raymond or PG.
- There are few libraries. Even though it's the oldest language still in wide use there seems to be a lack of libraries. This is probably the main reason PHP became so popular, along with it's friendliness towards beginners.
Unfortunately the (fragmented) Lisp community doesn't seem interested in addressing any of these problems, so my guess is that in fifty years Lisp will still be a minority language only used by a select few.
That may be true for some people, but it's definitely not true for me. I'd say I spend on average 10 hours thinking for every 1 hour I spend writing code -- and I write in C.
However, even in a language like C, whose basic building blocks are much simpler than those available in a Lisp, and even when writing a routine program with no fancy math or theory behind it — if one finds oneself having to write lots of loc per thought, then one is doing it wrong: and one stops and thinks, and works out a way to abstract out the drudgery with more sophisticated data structures and preprocessor macros, or whatever.
I'd contest both points, really.
First, I think if you're sufficiently comfortable in almost any language, you can translate pretty fluidly from idea to implementation. There are real differences, but they're overstated. In that respect, Lisp's "hardness" is really not being deep into the language and natively breaking problems down in a way that maps to functional languages.
Second, and I think your point, is that getting to that point where you've got the problem broken down into its components is the hard part. I think there are tasks where that's true and ones where it's not, and again, that's largely language independent, though the amount of time needed for the more menial aspects does vary.
I think that may be a valid argument if you're talking about a mostly-functional dialect of Lisp like Clojure. Common Lisp and Scheme don't really offer any resistance to writing in an imperative style
If there is one common mistake I am guilty of then it is to sit down and start coding too soon.
The current generation of Lisp users is the last one. Python and Ruby have enough of Lisp's features that switching to a "real" Lisp offers rapidly diminishing returns. Haskell and F#/OCaml and Erlang are alive and well and gaining new users and taking things in a different direction. The argument "but it's too difficult for commercial programmers" makes Lispers feel good, but it simply isn't true. Commercial programmers once wrote vastly complex systems in assembly language. And anyone who can use C++ in anger is certainly smart enough to learn any language.
If there's hope it lies in Clojure but again, it's not entirely clear that Clojure offers significant advantages to someone who is already getting stuff done in one of those others (and the average Java programmer doesn't understand why anyone would use anything other than Java).
Processing a directory full of flies using as many threads as there are cores.
No UI-hanging due to long-running callbacks.
Automatic queuing of actions started from the UI
Fast, statically typed primitive operations, but only when I ask for them
Friction-free access to Java's rather sizable collection of libraries
I didn't write any macros, so all of this would have been possible in a language with Clojure's features and a non-Lisp syntax. That said, I have no doubt that if I write a longer program involving Swing, there will be macros involved, and they will save a significant amount of pain.
- Yes, it's different. The Lisp community was interested enough in this problem to create Dylan, but that didn't work, and it wasn't really Lisp anymore.
- Try finding something more beginner-friendly than DrScheme. Actually don't. You'll be wasting your time.
- The Lisp community has always been interested in fighting fragmentation. SRFIs are being implemented in a wide range of Scheme implementations. I'm less familiar with the Common Lisp side, but I'm pretty sure a lot's been done there too.
- I think by writing code. I wrote C for 12 years, and that code has more comments because I would first write what needed to be done as a series of comments, then fill in code under each comment. Lisp is actually a lot easier once you get used to it.
- I use Kawa Scheme, which like Clojure and SISC runs on the JVM and has easy access to all Java libraries. But generally you choose a Lisp not to use libraries but to create a program that's in a class by itself.
Boy, am I glad to see that somebody else figured this out.
The lack of libraries which is the objection du jour against Lisp is actually connected to its strengths. First, there's less of a need for many libraries because it's so easy to write your own things. Second, Lisp's value goes up (and libraries' goes down) the more you get into problems that aren't well understood. But then a lot of problems get more open-ended, when you're working in a medium that encourages exploration.
If it's so easy, why aren't there good libraries for it? Nobody has done it because it's too easy? Eh? It's ridiculous and counter to the point of programming in general to suggest people ought to keep reinventing something because it's easy to do so.
Even worse, if it is easy, then it's merely a distraction not a challenge - causing you to lose where you were in your program while you think about reinventing an easy wheel.
Not that I believe it for a minute - implementing a good library to do something complex isn't easy - I just don't think "I want a script to process email, I could use Python and start with 'import email, pop' or I could go with Lisp and reimplement a POP client and an SMTP/MIME email parser it'll only take a minute".
It's true, though, that the point is a counterintuitive one (especially given current fashions). Perhaps it deserves a better explanation. Or perhaps not, but it's something I've been thinking about for a while, and I'm going to take this as an excuse to write about it.
When a problem is well-defined, complex, and clearly tangential to your project (not part of its core), the value of a library goes up. We use such libraries in Lisp for things like SHA1 and regexes. These are not the kind of libraries I was talking about. Notice, too, that contrary to your claim, such libraries exist. And are good.
When, however, a problem is not so well-defined, not so complex, or belongs to your core domain, the value of a library goes down. This is the space I was talking about, where the cost-benefit breakdown is not so obvious. There's cost involved in using a library too: the cost of learning it, calling it, and depending on it, not to mention the loss of fine-grained control. You have to compare that to the value the library provides, and compare both of those to the cost of writing your own thing. This is where my point comes in: that cost is not the same in every environment. It's lower, for example, in Lisp. This is one of the reasons why libraries are less central to Lisp culture.
Not surprisingly, people who believe that programming mostly consists of writing glue code that calls libraries have trouble conceiving of that. Although this belief is common right now, it seems to me oddly reminiscent of the "programming will mostly consist of stringing together black-box components" meme that crashed and burned years ago. In any case, the way it's wielded nowadays as an objection against Lisp is merely a prejudice. These people "know" that Lisp can't be good because it doesn't match what they "know" about programming. It reminds me of the joke, "I can see it works in practice, but does it work in theory?"
I'll give you an example of the second kind of library. When I started working in Lisp, I looked around for the unit-test framework that people were using (the Lisp equivalent of JUnit). I didn't find one. I found a half dozen half-baked candidates, none of which made very much sense to me. This puzzled me for a long time. Were Lisp programmers really that backward? Everybody has a JUnit. I finally decided to write my own test scaffolding, and in doing so I understood the answer to my puzzle: it was just so easy, I didn't need a library. I just wrote code to test my code. Naturally I did this in a way that was designed to work well with the particular system I was building - no need to force it to conform to a pre-existing framework. I would never dream of writing such a thing in (say) C#, yet in Lisp it is so natural that not doing it is what's weird.
From this and other experiences, I came to the conclusion that when working in Lisp, it's often easy enough to just write what you need. It's not reinventing the wheel, exactly. It's more like: if I just need a couple of spokes, why go to the trouble of buying a whole wheel? I'll just whip up a couple of spokes and move on. This obviously works better in cases where it's possible to fragment the problem that way (as opposed to cases like an SMTP parser where you need the whole thing in order to get any of the value).
Different programming languages and environments are not created equal; each has its strengths and weaknesses which give rise to its particular culture. The lessons of one don't always translate directly to the next, which is a good reason to not leap to judgment.
Not surprisingly, people who believe that programming mostly consists of writing glue code that calls libraries have trouble conceiving of that.
Thank you for your explanation.
A note on the lisp community: In looking for the imap library, I also found mel-base http://www.cliki.net/mel-base and sent an email to their devel list and got an answer from the mel-base author, Jochen Schmidt, within about an hour to use cl+ssl (which we already use with cl-smtp to send email)
I sent John Foderaro an email about ssl with Post Office (we'll see if he answers - Post office has a really nice conceptual structure to it), but I will definitely blog eventually about a Lisp library solution using IMAP with ssl, even if I have to make the extension myself. It shouldn't be too hard using cl+ssl.
Depends what you count as major.
I like that, Lisp used to make something used to make something.
"Here's an indisputably real-world example: AutoCAD. Most of it is written in a customized LISP; the C part is the LISP interpreter core." -- ERS