views:

5030

answers:

11

Which would you recommend learning, CL or Scheme? What are the pros and cons of each, compared to eachother?

A: 

I learned both of these in college and have to say they are strange languages to learn, I am assuming you are concentrating on AI?

I would recommend Lisp out of these 2 choices. It is much more common as an actual useful language in the filed of AI, whereas Scheme is more looked upon as a learning language in my experience. Both offer the same strange programming approach (like comparing Java and C#). Lisp also has a larger community behind it.

The pros and cons of both of them are almost the same, so I make my recommendation more on experience. The nice thing is, if you learn one, you will be able to pick up the other in no time.

Do yourself a favor, and get a good editor with bracket-matching... those parentheses get out of control :)

naspinski
AI and avionics, yeah.
TraumaPony
"I am assuming you are concentrating on AI", is that a joke? come on, Lisp is no the AI language anymore; actually: "I would recommend Lisp out of these 2 choices", Lisp is not a language anymore. Common Lisp and Scheme both are Lisps (and so is Arc, Clojure and many others).
J. Pablo Fernández
+2  A: 

Scheme. Its a smaller language, but still teaches you the good things you can take away from a Lisp-like language.

Quite frankly, you will likely not be using Lisp or Scheme if you make a career in software development. There is not much work being done in that language, Paul Graham notwithstanding. Learning the Lisp mindset makes you a better developer, but learning the nuances of Common Lisp and the CLOS is probably not a good use of your time.

DGentry
Indeed, I have no intention of using it professionally; I just wanted to see which one was (relatively) worth learning.
TraumaPony
+15  A: 

Scheme has one big advantage: SICP lectures that are available on the internet. It's a great fun to follow them with an interpreter onboard.

The advantage of Common Lisp is more-or-less stanfard set of common libraries.

So, if you want to do real-world development, consider C.Lisp. If you want learning and fun, use Scheme.

Maxim Ananyev
Yeah, I've downloaded and watched all of the SICP lectures and read the book; they were awesome. :D
TraumaPony
Note: See the SICP Website, including the full text of the book <http://mitpress.mit.edu/sicp/>
Sébastien RoccaSerra
+23  A: 

From a section of the introduction of Practical Common Lisp (great resource to learn common lisp, by the way):

If you've used Lisp in the past, you may have ideas about what "Lisp" is that have little to do with Common Lisp. While Common Lisp supplanted most of the dialects it's descended from, it isn't the only remaining Lisp dialect, and depending on where and when you were exposed to Lisp, you may very well have learned one of these other dialects.

Other than Common Lisp, the one general-purpose Lisp dialect that still has an active user community is Scheme. Common Lisp borrowed a few important features from Scheme but never intended to replace it.

Originally designed at M.I.T., where it was quickly put to use as a teaching language for undergraduate computer science courses, Scheme has always been aimed at a different language niche than Common Lisp. In particular, Scheme's designers have focused on keeping the core language as small and as simple as possible. This has obvious benefits for a teaching language and also for programming language researchers who like to be able to formally prove things about languages.

It also has the benefit of making it relatively easy to understand the whole language as specified in the standard. But, it does so at the cost of omitting many useful features that are standardized in Common Lisp. Individual Scheme implementations may provide these features in implementation-specific ways, but their omission from the standard makes it harder to write portable Scheme code than to write portable Common Lisp code.

Scheme also emphasizes a functional programming style and the use of recursion much more than Common Lisp does. If you studied Lisp in college and came away with the impression that it was only an academic language with no real-world application, chances are you learned Scheme. This isn't to say that's a particularly fair characterization of Scheme, but it's even less applicable to Common Lisp, which was expressly designed to be a real-world engineering language rather than a theoretically "pure" language.

If you've learned Scheme, you should also be aware that a number of subtle differences between Scheme and Common Lisp may trip you up. These differences are also the basis for several perennial religious wars between the hotheads in the Common Lisp and Scheme communities. I'll try to point out some of the more important differences as we go along.

Two other Lisp dialects still in widespread use are Elisp, the extension language for the Emacs editor, and Autolisp, the extension language for Autodesk's AutoCAD computer-aided design tool. Although it's possible more lines of Elisp and Autolisp have been written than of any other dialect of Lisp, neither can be used outside their host application, and both are quite old-fashioned Lisps compared to either Scheme or Common Lisp. If you've used one of these dialects, prepare to hop in the Lisp time machine and jump forward several decades.

Vinko Vrsalovic
Heh, I actually had that open in another window; I can just see the top line of it cut off in it.
TraumaPony
The excerpt is misleading/wrong. There is no single "Scheme designer group" and nearly every distribution is built for accomplishing "real-world" work.
grettke
@grettke: You might want to talk about that with the book author. The link is right there. I personally don't think that the author is claiming what you are interpreting from the text. He says Scheme was **originally focused on simplicity** and teachability and that particular implementations do have 'real-wordly' features in an implementation specific manner. He also points out that saying Scheme is only academic isn't a particularly fair characterization of it.
Vinko Vrsalovic
+4  A: 

It depends on what you want to do with the language.

Scheme is very much the standard for education and research. If you want to try implementing new type systems for your PhD thesis, Scheme is probably the way to go because it's easier to analyse and reason about.

For real applications, I strongly recommend Common Lisp, however. There is something to be said for choosing PLT Scheme, but that locks you into a single implementation (which may or may not be a problem for you).

Common Lisp is an industrial-strength standard with various free and commercial implementations that produce fast and robust code. The commercial implementations come with their own IDEs; on the other hand, SLIME is too awesome to neglect looking at it. Also, its culture encourages programming in a dynamic and interactive way (this is the most important thing that I personally miss whenever I look at Scheme) and mixing all programming styles that you can name to your heart's content (while Schemers tend to frown upon imperative style).

Finally, cliki.net and cl-user.net may not be the best structured websites on the planet, but there are much more portable Common Lisp libraries there than I could ever find for any Scheme implementation.

Matthias Benkard
Scheme is no longer used much in research, and its use in education is (sadly) somewhat limited. I think the reason for the first is that its specialities, like `call-cc`, are no longer popular topics. The reason for the second? People want to learn something they can get a job with, I guess.
Nathan Sanders
+3  A: 

Scheme. The core language is small. The "define" operator makes defining functions and variables very clean. It supports tail recursion. You can build object oriented programs in Scheme. One of the best computer science textbooks ever written is "Structure and Interpretation of Computer Programs" by Abelson and Sussman. References to this book have appeared quite a number of times in answers to various Stackoverflow questions.

mxg
+5  A: 

As a Schemer, I find it difficult to work with Common Lisp when I have to. Most of it stems from having to separate the function namespace and the variable namespace. This leads to two separate ways of defining stuff and two different let-like syntaxes for temporary definition. There's also the fact that Common Lisp doesn't provide explicit access to the continuation and therefore if you want to do something that involves saving and restoring state you have to keep track of it manually.

There is one good feature about Common Lisp - the macro system is much easier to use than Scheme's (which I have yet to fully master). Paul Graham is working on a dialect of Lisp called Arc that combines the unity of Scheme and the ease of the CL macro system. It's a rough draft right now, but it does have significant promise.

Kyle Cronin
+1  A: 

For learning a Lisp, scheme resources are unsurpassed, and the PLT IDE provides excellent suport for learning. Guessing you are already an experienced programmer in another language, I'd suggest starting with The Little Schemer and TSPL, on PLT-Scheme.

Of course that doesn't answer the question.

The answer to your question is it depends on what you want to do?, and the answer would probably specify an implementation.

Do you want to do AI, write a DSL, write fast code or target a VM?

[The broad answers are probably, Lisp, Scheme, SBCL, JScheme or Kawa.]

Stephen
+6  A: 

I've spent weeks wrestling with this same question having been inspired by Paul Graham to learn 'Lisp'.

I eventually gave up on CL because I couldn't find a free implementation that worked well enough on Windows that could also generate a small standalone executable.

I settled on Scheme, using Gambit-C and Eclipse with Schemescript as the IDE. This worked extremely well for me because you can prototype in the interpreter and then every so often hit the make button and out pops a credibly small self-contained executable.

It is also incredibly easy to interface to C so you are never short of a library to do a task. For example I need a HTTP client that supports SSL - I simply wrapped a couple of the wininet functions and I was in business.

Think of it more as a familiar C development environment with the advantage that you can glue all the low level code together in a more productive Lisp type language.

I *love* Gambit-C. Chicken is also really good.
Jyaan
+6  A: 

Neither: Clojure. Honestly after many years of banging my head with both Scheme and Common Lisp endless list of implementations and idiosyncrasies, I'm happy hacking away on Clojure.

I know this not really an answer to your question, but as your asking for opinion, I'm giving you mine (and I wished someone told me this when before).

J. Pablo Fernández
A: 

I recommend Scheme. As stated before, the LISP-derived families aren't used much in the wild. The value of learning a LISP-derived language is developing new ways of thinking, which Scheme does in a very plain, straightforward way with great documentation and software available.

And I'll plug Dr. Scheme while I'm at it. :)

Disclaimer: Python/Scheme programmer who uses Dr. Scheme

J.T. Hurley