74

Which Lisp (dialect) should I learn, and why?

The fragmentation between CL and Scheme slows uptake (at least for me!).

So, give me the "true answer", please!

I have tried to read feature comparisons, and they seem to get bogged down in esoterica (that I don't fully understand) like whether the dialect is fully tail-recursive, and the like. I'm hoping you all (collectively) can make the opaque differences clear.

Things I like

Good library support, good environments, and Unicode support.

Things I dislike

Flamewars. Features that are useful at the beginning, but interfere with long-term learning.


Updates

  1. I've been mostly using MzScheme, which I'm enjoying just fine, once I got readline support going. I don't run a GUI on Unix, so it seemed to be a fine environment option for me.

  2. I'm also very happy that Clojure has an easy to install .deb package on debian, so it's much easier to play with. This is a big win. Despite the hostility of some rather easy-to-anger below, low barrier to entry is a win. I like being spoonfed.

  3. After reading a lot more of SICP, I do understand the issues around tail recursion much better.

nbro
  • 15,395
  • 32
  • 113
  • 196
Gregg Lind
  • 20,690
  • 15
  • 67
  • 81
  • A deb package to install it? I certainly hope it's the 1.0 release otherwise, you're probably using something ancient. I don't getting something off an svn and typing "ant build" creates a high barrier to entry. Not to mention that since the 1.0 release, there is no reason to get anything off the svn unless you want to have the bleeding edge. – Rayne Jun 01 '09 at 23:33
  • Well, you're welcome to decide for yourself what's a barrier to entry. I don't work in Java, and I don't know its build system. I don't have ant installed. As it turns out, it is 1.0.0. I don't know why you follow this thread so closely, or why you want to keep insulting me and my opinions. It doesn't make Clojure more appealing with you as its advocate. – Gregg Lind Jun 05 '09 at 03:35
  • 6
    Coming back to this thread over a year later, I can see how I sounded like a dick here. I'd like to apologize for sounding like that. I think we are just different sorts of coders. Also, I think you'll find that the Clojure situation has improved quite a bit with stuff like Leiningen, Cake, and Cljr having been created. Once again, I'm sorry for sounding so offensive. I assure you, my intentions were pure. – Rayne Aug 25 '10 at 02:21
  • Rayne, it takes a lot of stuff to admit that sort of thing! I'm not sure how different we are, but my time is limited, and if it comes down to it, if a tech is friendlier, I will be likelier to use it. – Gregg Lind Aug 25 '10 at 16:19
  • Tail-recursion "esoterica"? It's no stranger than the `for` and `while` loops you find in imperative languages. – new123456 Apr 17 '11 at 21:58
  • This question would be more relevant on http://programmers.stackexchange.com – Anderson Green Sep 05 '12 at 16:26
  • is Python a Lisp? – X10D Feb 03 '20 at 21:02

17 Answers17

65

Clojure is an actively developed, modern dialect of Lisp. It's based on the JVM, so all the Java libraries are immediately available, and therefore also has Unicode support.

This is one alternative, not the One True Answer.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 10
    but it's hopelessly hindered by that JVM. how can you call LISP a non-tail-recursive language? – Javier Feb 19 '09 at 00:10
  • 3
    Common Lisp is not tail recursive either. I agree that tail recursion is good; I'm working on a Lisp dialect similar in spirit to Clojure but hosted in Python: http://ghewgill.livejournal.com/tag/psil for more info. – Greg Hewgill Feb 19 '09 at 00:14
  • 9
    Javier, Clojure has a `recur` (that can only appear in a tail position) that gives you a tail-call that you can naturally express recursive functions with. The JVM hindrance that I've seen anyone complain about: [no unsigned types](http://gnuvince.wordpress.com/2009/02/15/clojure-and-starcraft/). – ayrnieu Feb 19 '09 at 02:17
  • 1
    Clojure certainly has the advantage of creating immediately useful applications, since you have access to the Java BCL as well as any Java library. – Matthew Olenik Feb 19 '09 at 15:15
  • 9
    The JVM is central to Clojure's power, it's not hindered by anything. – Rayne Feb 20 '09 at 12:20
  • 1
    When I went to the site I was immediately turned off by what it talked about -- differences from other lisps, how to get it running under the jvm. Where's my hello world! – Gregg Lind Feb 20 '09 at 21:12
  • Seems one has to hack around limits of the IDE I can not see a good reason not to prefer LispWorks or AllegroServe – Friedrich Feb 21 '09 at 06:20
  • @Gregg I don't understand what you mean, what is the problem with that? It's not that hard to set up. Especially if you use Eclipse or Netbeans as an IDE for it. It's a perfectly LISPy LISP if that's what you are worried about, but there are differences and that's a good thing.There is a wiki with.. – Rayne Feb 21 '09 at 12:25
  • Code examples as well, along with other stuff. @Friedrich There is Cusp for Common LISP, there is Enclojure (netbeans) and Clojure-dev (Eclipse) for Clojure. We are not IDEless. – Rayne Feb 21 '09 at 12:26
  • @Rayne, my problem with it, is that as a new learner, those are the things I am absolutely least interested in. I view having to work in the jvm, and deal with any java stuff as a minus not plus. When I look at a new language's site, I want to see *how to code in it.* – Gregg Lind Feb 22 '09 at 15:28
  • @Gregg You don't have to worry about Java stuff. Dig a little deeper, there is a Wiki that's dedicated to "Hello world!" and getting you into the language. You're being weird right now o_o. – Rayne Feb 23 '09 at 15:13
  • @Gregg The Java or C# sites don't have hello world plastered on their front pages either. C and C++ don't even have web pages. :| – Rayne Feb 23 '09 at 15:20
  • Rayne, I'm used to Python, and R. Usability and teachablity matter. – Gregg Lind Mar 01 '09 at 16:32
  • Rayne, it just really turned me off, by focusing on the stuff that I'm least interested in, and showing what I consider a disregard for accessibility and evangelism. – Gregg Lind Mar 01 '09 at 16:34
  • I don't think you are looking to learn a LISP. If you want to try functional try Ruby. If you need to be spoonfed everything then you wont find that in Clojure. Not right now. – Rayne Mar 03 '09 at 18:56
  • If you're still interested in a LISP try http://www.ociweb.com/mark/clojure/article.html that's the closest to spoon fed you'll get out of a LISP. Just because you use Python doesn't mean you should expect every language to conform to it's profile. – Rayne Mar 03 '09 at 18:59
  • I tried Clojure now, "Hello, World" takes over 1 second to start and run for me. Is it supposed to be like that, or am I doing something wrong? – Johan Kotlinski May 18 '09 at 10:01
  • 5
    Just another comment on clojure. Clojure is a "pratical" and opinionated Lisp. Pratical because using the JVM give the reach to the biggest echosystem that exist today. Library support is astounding. And theses are very mature, broad and of production quality. Few echosystem can compare. Opinionated because clojure embrace immutability and avoid OOP at all costs. This is interresting and good. But you can find it anoying at time. This may not be your cup of tea. Clojure may not the best lisp from the learning perspective. But it is surely one of the best to make something professional with it. – Nicolas Bousquet Oct 08 '11 at 19:13
34

If you want avoid flamewars and you enjoy libraries go with Clojure. It's small, it's fast, and the community is helpful and non-dogmatic. It's Lisp minus the absurd cruft of the 1980s . It has a BDFL and if you have a good idea there's a damn good chance it will get implemented into the language.

I have toyed around with Common Lisp, it's a beautiful thing. I've completed the first 3 chapters and the Metacircular Evaluator in SICP in DrScheme, and that is beautiful thing as well. Of course, you will benefit greatly from learning these.

But, over time I have come to hold small languages dear to my heart. I won't lie, I love Javascript and I love C (and goddammit if every language doesn't have a C core at it's heart) because they are small.

Clojure is small. It is elegant. It is a language for our times.

dnolen
  • 18,496
  • 4
  • 62
  • 71
22

Just pick one, and learn it. By the time you figure out the differences, you'll be in a position to choose again, if you chose badly the first time.

Gregg Lind
  • 20,690
  • 15
  • 67
  • 81
  • I think this is a fine answer. But you don't have to go so far as to learn an entire language. I read enough about Scheme to know I won't be happy with it. Common Lisp is more my style, but it hasn't pulled me away from Perl. If you want to learn languages, you won't pick just one. – Jon 'links in bio' Ericson Feb 19 '09 at 01:04
19

Contra Chuck, an advantage of Common Lisp is that it has a standard that implementations stick to and strive for, such that you can develop largely with SBCL (which has excellent type checking and inference) and then, say, deploy as an executable linked with C libraries (with ECL or others) or as a .jar making use of Java libraries (with ABCL), or with a Mac or a Windows-native GUI (Clozure, both). Common Lisp is amazingly portable across architectures and over implementations and over time, and Common Lispers make efforts to keep things this way, with the support of the language. As an illustration, one silly divergence of unstandardized behavior is the question "is this a special variable?" So I answered it across the implementations I use:

#-abcl
(defun special-variable-p (symbol)
  #+ecl(si:specialp symbol)
  #+ccl(proclaimed-special-p symbol)
  #+sbcl(equal '(:special t)
               (multiple-value-list-int:info :variable :kind symbol)))

which reduces, at read time, to nothing on ABCL (it has this already), to (defun special-variable-p (symbol) (si:specialp symbol)) on ECL, and so on. So I can put this in my .rc files and use the common function at the REPL. But this isn't very important: this isn't threading or variously-backed networking or a Communicating Sequential Processes library. This last example just has one #+sbcl/#-sbcl even as it runs on five implementations. Because it relies on code that's been carefully ported.

But what permits this (and other) advantages also poses its own challenge to the learner: Common Lisp is a very big language. It isn't something you can slurp up in a week or two, like I did Clojure (but my Clojure is already decaying with the breaking changes set to roll out - that language, although heavy with its own merits, reminded me by contrast of a lot of what I like about Common Lisp.) So you should read a lot of this page, and keep the HyperSpec a keypress away (for me, M-x hyperspec RET do-symbols RET is sufficient nearness to the Bible.), and think about buying a few books. I have Practical Common Lisp, just got Let Over Lambda, and will buy PAIP real soon now.

But even if Common Lisp is the True Answer, you won't completely waste your time by 'just picking' some deceptively flashy alternative (-- 'deceptive' because commonplace CL doesn't show you all that its macros can do, and it has more kinds of macros than anybody. The usual comparison is between bad CL and syntax-optimized alternative X). You'll still learn the basics, you can still use much of what you can read in SICP, On Lisp, The Little Schemer, etc. A lisp, even the wrong lisp, is still better than a non-lisp. (But you'll spend some of your time implementing parts of the right lisp, poorly, in the wrong lisp. Meta-Greenspun.)

ayrnieu
  • 1,839
  • 14
  • 15
  • 1
    How is Let Over Lambda? I've been considering purchasing that for the rest of the chapters that aren't online. – Greg Hewgill Feb 19 '09 at 01:57
  • I'll let you know. All I've done so far is skim through the Forth chapter. – ayrnieu Feb 19 '09 at 02:10
  • OK. I'd have to think a while, and try to recall earlier stages of my development, and reread other books to be fair to them. But absent that: LOL is the best. The book paints a target on the 'stylistic aphorisms' against macros, italicized on the first section of the first chapter. – ayrnieu Feb 21 '09 at 06:52
  • Thanks for that, I've ordered a copy! – Greg Hewgill May 04 '09 at 21:59
  • Thank goodness for #+ and #-. Without them, accessing CLI arguments, and any other POSIX behavior is next to impossible. http://rosettacode.org/wiki/ScriptedMain#Common_Lisp – mcandre Mar 08 '11 at 02:15
19

Clojure is a great dialect of LISP that promotes functional programming. It runs on the JVM so you have access to any Java libraries you might be used to using. The site has great documentation and screencasts to help you learn. Another advantage is that it's really easy to install, unlike a lot of other dialects.

If you're just looking to grok the concepts Emacs (EmacsLISP specifically) is another alternative. It comes with incredible documentation, tutorials, and lots of code samples. Screencasts are fairly easy to find as well. One of the great benefits of Emacs is that the editor is written in LISP so the editor naturally has very good support for running, editing and debugging LISP. In addition, you can extend the editor to make your every day text editing needs easier while you learn LISP.

Bryan Kyle
  • 13,361
  • 4
  • 40
  • 45
9

Lisp's biggest problem is that there's no overriding standard everyone sticks to. You don't just have to pick between Common Lisp and Scheme; you have to pick between several incompatible implementations of Common Lisp and several incompatible implementations of Scheme, as well as other little things like Arc and Clojure.

I would recommend starting with MzScheme. It's popular, it's actively developed, it has many libraries offering the features of a modern programming environment, and Scheme is somewhat simpler (not to say better, just simpler) than Common Lisp.

Chuck
  • 234,037
  • 30
  • 302
  • 389
  • 1
    Common Lisp is a Standard. So are the diverse RSx Scheme standards. What I dislike mostly about DrScheme is it's standard Object model. – Friedrich Feb 21 '09 at 06:17
7

Learn elisp so you can extend Emacs.

mletterle
  • 3,968
  • 1
  • 24
  • 24
6

Go with Clojure. It's an amazing language with full access to any Java library. It has been in development for just over 2 years and already has 3 IDE plugins in development and a book being published in April about it. It's very fast, very elegant and beautiful. You can't go wrong with Clojure.

Rayne
  • 31,473
  • 17
  • 86
  • 101
5

For me, the foundational theory of Scheme is far more convincing. PLTScheme (now called Racket) is, by far, the most actively developed LISP I've found. Unfortunately, it has a proliferation of typing that obscures the beauty of Lisp.

I'd love to see something like arc succeed, but it seems unlikely.

hoijui
  • 3,615
  • 2
  • 33
  • 41
Javier
  • 60,510
  • 8
  • 78
  • 126
4

Take a look at IronScheme.

Nemanja Trifunovic
  • 24,346
  • 3
  • 50
  • 88
4

Conjecture: when learning your first lisp, don't learn one you'll end up using for end development.

Lemma: learn Arc. It's all of the "hard to grok" things in lisp - closures, macros, continuations, with none of Clojure's Java interop complexity, CL's namespace confusion, or Scheme's name fragmentation. If you're dedicated, you can learn all of these things in a weekend. If you're sharp and dedicated, in a night.

And it'll make learning all the other lisps a lot easier.

Andrey Fedorov
  • 9,148
  • 20
  • 67
  • 99
4

I do not know Lisp but here's why I think PLT Scheme (now called Racket) is a good choice:

  1. Really Good Documentations
    http://download.plt-scheme.org/doc/html/

  2. DrScheme
    DrScheme is an amazing programming environment that comes with a compiler, stepper, syntax checkers, REPL, myriad of languages support and is extensible. This makes the entire experience fun. See some screenshots

  3. Good Support from the community.
    The community is very enthusiastic about their language and very supportive too. If you have any questions, mailing lists, groups and forums are available. Even the authors are very very accessible.

  4. Continuing Research
    PLT is very active and continue to make their tool better and better. You can expect a lot of innovations from the labs. eg. Im pretty excited about using this: http://blog.plt-scheme.org/2009/05/typed-scheme-20.html

  5. Free Books and interesting tutorials to get you started.
    http://www.htdp.org/
    http://world.cs.brown.edu/

  6. Good modules and extensive libraries.
    http://www.cs.utah.edu/plt/develop/
    http://planet.plt-scheme.org/ also see docs

If you are learning Scheme, give DrScheme a try.

hoijui
  • 3,615
  • 2
  • 33
  • 41
unj2
  • 52,135
  • 87
  • 247
  • 375
3

You know... When I got interested in Lisp I also thought I'd have to choose. Then, after reading and asking a lot, I ended up choosing Common Lisp. Not because it's "better" than Scheme in an absolute way, but because it had features I knew I'd probably use in the next 2-3 years in my projects:

  • A very efficient compiler for numerical computation (SBCL),
  • The condition system, and...
  • I have to admit that SLIME also played an important role in this decision. :-)

So if I were you, I'd start learning a tiny bit of each language, and find out what are the relative strengths and weaknesses of each (I mean, those related to what you'll need/want to do most often) so you I could pick one. You may just find out that you'll learn the other later also (happened to me -- I had to learn more Scheme after one year studying Common Lisp)

As to Arc, Clojure and Lush, and don't know those. I suppose the same argument could apply to them too... The reasons I didn't want to invest too much on them were: Arc does not seem to be interesting for numerical computing, and P. Graham seems obssessed by code size (to the point of making his code unreadable); Clojure seems nice, but I don't like the JVM. And Lush... Well, besides using dynamic scope, the compiled and interpreted versions of the language are very different -- and you can't compile recursive functions. So, it was either Scheme or Common Lisp to me.

Jay
  • 9,585
  • 6
  • 49
  • 72
  • 2
    Clojure is lexically scoped, with thread-local dynamic scope of (usually toplevel) vars via `binding`. – Brian Carper May 31 '09 at 03:51
  • @Brian Carper: thank you! I didn't know Clojure was lexically scoped. I vaguely remember having read on clojure.org that it had dynamic scope, but I probably mixed up facts. – Jay Jul 14 '09 at 22:03
1

Pick anything but Clojure, go with it, and you will be in a better position to evaluate later.

You phrased this question as which Lisp is the best medium for learning Lisp, and to me that has to include a Lisp that is built up from low level primitives, whereas large parts of Clojure are written in Java.

If you had phrased this question as which is the best Lisp to start a new project in, then Clojure may be the best choice.

Kevin Peterson
  • 7,189
  • 5
  • 36
  • 43
  • > Pick anything but Closure I really wished I see a counter-argument to 'access to all JVM libraries', because I really really can't imagine what java am I going to use if I pick up on LISP/Scheme – Vlagged Jul 14 '09 at 22:29
  • Please support that statement. Why shouldn't we use Clojure? – Adam Arold Dec 07 '11 at 19:40
  • @edem did you read beyond the first four words? First, I never said you shouldn't use Clojure. If you want to use Clojure, go for it. If your goal is to learn Lisp, on the other hand, you would do well to start with something closer to the main line of Lisp. For example, in Clojure tail recursion needs to be explicit in the code. Much of the library is implemented in Java. You'll also run into "is weird feature X part of Lisp or specific to Clojure". – Kevin Peterson Dec 12 '11 at 03:21
  • I started Clojure after finishing Practical Common Lisp tutorial. :) Thanks for the info. – Adam Arold Dec 12 '11 at 11:47
1

I think you either want Common Lisp or PLT Scheme (now called Racket).

The former comes with a lot of freedom and power (that might overwhelm you at first) and the latter comes with a bunch of libraries, matching tutorials and a well-integrated IDE.

hoijui
  • 3,615
  • 2
  • 33
  • 41
Leslie P. Polzer
  • 2,998
  • 21
  • 18
0

I am a fan of Scheme, but it has been more than 10 years since I did anything with Scheme.

like others have said - just pick one and go.

Tim
  • 20,184
  • 24
  • 117
  • 214
0

There are very few real choices there, either SBCL, Clojure or PLTScheme.

Marko
  • 30,263
  • 18
  • 74
  • 108