views:

778

answers:

13

I've got a little experience with Python (enough to where I can do if/else/elif and some random number generation), but I've always had a weird fascination with the Lisp languages. I downloaded some scheme source code to look at the syntax but it was pretty much gibberish to me.

For a programmer with only a little programming experience like myself, given some good books, websites, and some time, would it be particularly difficult to learn either Common Lisp or Scheme? Which of the two would be easier? How do they compare with Python and C, as far as ease of learning?

Thanks

+19  A: 

Get SICP (Structure and Interpretation of Computer Programs). It was the entry level CS class textboox at MIT up until very recently. It is entirely based on Scheme. If you enjoy CS at all, you will love this book. It's fantastic. You'll walk away a much better programmer too after reading it (and ideally doing most of the exercises). It's an ideal beginner's book, it starts at the very beginning and eases you up to being quite competent at Scheme. However, it is a college textbook, so unless you have a bit of a knack for programming, it may be a tad on the tough side.

Matt Greer
Agreed, this book is (or was) used as the introductory text for computer science at MIT, and it really covers a lot of ground.
Greg Harman
It's not anymore. MIT has since moved on and is using Python as their introductory language now. Which is a shame IMO.
Matt Greer
It doesn't teach you Scheme, though. The amazing thing about the book is that it teaches you pretty much *all* of programming and computer science using only a tiny subset of an outdated version of Scheme. In other words: SICP teaches you *everything* but not Scheme.
Jörg W Mittag
That tiny subset of an outdated version of Scheme in fact seems to be the very essence of Scheme. In other words, once one grasps (to a sufficient degree) *everything* that SICP sets out to teach, understanding (the core of) Scheme happens as a side effect. :-)
Michał Marczyk
+2  A: 

Scheme is (intentionally) more compact than Common Lisp, and you'll find that you can learn the language very quickly. Now, mastering the (any) language and computer science concepts is another story, and @Matt Greer's book suggestion would be a wonderful place to start.

Greg Harman
+2  A: 

Lisp isn't hard to learn. It can be taught poorly, and it does have some "high level" concepts, especially if you're coming from the imperative "classic" programming world.

But today, may of the modern languages have aspects very similar to what Lisp offers, so there is likely not much "new" in Lisp compared to other languages, especially Python.

My "hurdle" with Lisp (and Scheme) was simply "lambda". Essentially, my fundamental problem was I had nothing to relate to what a "lambda" was, why it was called "lambda", etc.

If it was named "function" or "routine" or something, it would have been trivial. But as is, the word "lambda" was meaningless in every way. They could have called it "mork", "bleem", or "fizbin" and it would have been as useful.

Once I grokked "lambda", the rest fell in to place.

If you're interested a A Lisp (i.e. a language which is essentially from the Lisp family), then Scheme is a good choice. But, Scheme is NOT Common Lisp (which is what "Lisp" typically means today), they are really different languages.

If you want to learn Common Lisp, I would start with Common Lisp and skip Scheme.

You can look to Practical Common Lisp to get you in to writing Lisp without "having to learn it" so to speak.

Will Hartung
I'm just learning scheme, and had the same problem with lambda, until somebody explained that it was like an anonymous function in imperative programming.
Cam
+16  A: 
Norman Ramsey
I disagree that SICP is "not at all suitable for beginners". It does depend on who the beginner is for one thing. After all, not everyone dropped out of 6.001 back in the day. Yes, it is a tough book, and may be tough to tackle without the help of a professor and/or TA to work through it. But at the risk of sounding arrogant, this industry could use more people that began on a book like this. Programming computers is not easy. Challenging your intellect and understanding that to master this craft is quite a commitment is a good thing to know from the get go. A book like SICP helps cement that.
Matt Greer
@Matt: You make my case for me! SICP is a *terrific* "cementing" book. As a starter, not so much. For me it's not the toughness of the book; it's the audience. When you know some CS and have some programming under your belt, it's not a tough book at all. Instead it's **one "oh, wow" moment after another.**
Norman Ramsey
"I think it's harder to learn C than to learn either Python or Scheme" - shouldn't that be "easier"?
Frank Shearar
@Frank, not really I think, that was the point, C is heavy on pointers, which have always been a hard point in programming (also you get annoying errors from pointers).
Michael
Yes, exactly - "I think Scheme's _easier_ to learn than C because you have to understand pointers, dynamic memory, etc. before you understand C"
Frank Shearar
Simply Scheme was the book that let me grok Scheme/Lisp. Mostly because they, effectively, teach Scheme using their own subset of the language. Like, teaching Commmon Lisp with "first" instead of "car". So, the "arcana" of historical baggage is cast aside letting them teach you the concepts without fighting the symbology inherent in a compliant Scheme or Lisp. It works very well and is great at getting folks over some hurdles and in to Scheme/Lisp.
Will Hartung
It took me several months to go through all of SICP -- which I used as a starter book in my own self-study programme -- so I suppose it was tough, but at the same time it was absolutely *fascinating*, so it was no problem to stay motivated. Also, I find that SICP is fantastically well written, so there is nothing to hinder one's efforts in reading it except the inherent complexity of the subject matter. As long as one stays interested, that is a welcome challenge. In other words, I am entirely in agreement with Matt.
Michał Marczyk
Norman have you seen the SICP lecture videos from MIT? In my opinion, they are much easier to follow than the book.
CaptainCasey
Norman Ramsey
PLT is now Racket - http://racket-lang.org/
Peter Ajtai
+1  A: 

I'd say a Lisp will be easier to learn as a new programmer than if you wait. That's because the way most languages encourage you to think about programming is a handicap to learning Lisp; being experienced with a more conventional language will probably help in some ways, but not with the qualities that make Lisp unique.

Scheme --- the Lisp with which I'm most familiar --- is probably about as easy as Python to learn, especially if you choose PLT Scheme (now renamed Racket), which offers you a lot of helpful extensions. Common Lisp is probably about the same difficulty, though I find it less instinctive for reasons which are probably not universal. I have found C much more difficult than either, for the reasons Norman Ramsey suggests.

What one I'd suggest learning depends very much on what you want to do with it. If you want to learn a crystal-clear language with no frills, whose core can be learned quickly, learn a Scheme that implements the R5RS standard, such as Scheme48. If you want a more capable Scheme, either immediately or later on, learn PLT Scheme/Racket. If you want a big, friendly, diffuse language of immense power but not as visibly internally consistent as Scheme, choose Common Lisp; Steel Bank Common Lisp is a good implementation.

JasonFruit
There is some truth to that, isn't there.
JasonFruit
A: 

Consider (the poorly titled) "Programming Languages, An Interpreter-Based Approach" by Samuel N. Kamin. You'll learn how to program in 7 different languages (including Lisp, Scheme, SASL, CLU), plus how to implement interpreters for each. You should come away with a good understanding of how the languages differ, why they're designed the way they are, what are the tradeoffs in using them, etc.

joe snyder
+3  A: 

Get

"The Little Schemer"

and

"The Advanced Schemer"

These books are INVALUABLE as programming concept aides. I'd personally do them before SICP just because SICP is a bit fast if you haven't programmed much before... and even if you have they're great books!

I personally think of Scheme as a very good pedagogical language. It can be used for just about anything I suppose, but it's very good for teaching programming constructs without getting bogged down in syntactical issues. The closest thing to pure semantics you're going to get.

Michael
+1  A: 

As to which is easier, Lisp or Scheme, being "dialects" of the Lisp family, at the beginner level they are pretty much the same thing and interchangeable. I learned Common Lisp from Peter Siebel's "Practical Common Lisp", then picked up SICP and worked through all the exercises through the first two chapters using Common Lisp rather than Scheme. There are just a few different keywords and things like the use of funcall in CL where just a pair of parentheses would suffice in Scheme.

Both Siebel's book and SICP are available for free in their entirety on the web. Download them and get hackin'!

Paul Richter
+1  A: 

Last time I checked the lectures from the intro classes for CS61A at Berkeley which used SICP were available from iTunes, which would give you a full lecture series to help you learning the language. For free! I TA'd for Brian Harvey back in the late 90's and students really liked his lectures.

http://deimos3.apple.com/WebObjects/Core.woa/Browse/berkeley.edu.1621506930

Nathan S.
+1  A: 

I would recommend going with Common Lisp.

It has excellent implementations that provide a variety of different capabilities. The best ones are still the commercial implementations (though they have no-cost versions for learning Lisp) like Allegro CL from Franz and LispWorks. They offer extensive libraries and include GUI-based development environments. But the open source and free implementations are excellent, too: SBCL, CCL, ECL, CLISP, ...

There are a bunch of excellent books for Lisp, like Peter Seibel's Practical Common Lisp.

Learning Common Lisp is not that difficult, but getting deeper experience get take some time, because the language and its eco-system is surprisingly rich.

Learning Scheme is useful, too. Also learning SICP can help. But there is no immediate need, since the Lisp literature talks about many of the same issues. Unfortunately Scheme lost some of its appeal in recent years (I find the latest R6RS to be totally disappointing) and I find also implementations like 'Racket' to be moving in the wrong direction. Instead one might want to learn some of the better ML dialects and implementations (say, OCAML). Though it might be interesting to check out various Scheme implementations, there are some with interesting capabilities.

The core ideas you should learn from Lisp are these:

  • multi-paradigm programming
  • programmable programming language
  • symbolic computation
  • interactive and exploratory development

Learn how Lisp supports these ideas and why they are important.

Rainer Joswig
A: 

Relatively, it's a very difficult language to learn if you are as stubborn as I am :) Python is an OOP language, and while FP is possible, it's still OOP. Lisp is a FOP language like Haskell. Like Python, it can do OP, but it's still FOP. Terms used: OOP = Object Oriented Programming OP = Object Programming FOP = Functional Oriented Programming FP = Functional Programming

Alex
A: 

If you are fascinated by the language, i think you will find it easy. But i must say it's not for everyone. I tried several times learning Scheme and Common Lisp and lost interest. When i see an "if" in a programming language, i start looking for "then", "else", an open-brace, a colon, etc. but Lisp has none of that. I only see a soup of parenthesis.

Besides, some concepts are easier in other languages. I agree with the guys who don't like the word "lambda". I really got it when i learned Lua (Javascript is very similar). In Lua and Javascript, when you need an anonymous function, you type (guess what) "function(etc. etc.)". When you want to create a closure by returning a function, you write (guess what) "return function(etc., etc.)". In Lisp, you write "lambda" and use the implicit return at the end of the function. Not very beginner-friendly.

I aslo agree with Norman Ramsey: Don't use Structure and Interpretation of Computer Programs (SICP).

This book is weird. It starts really easy, on page 1 you learn some expressions like (+ 137 349). Easy as pie. Then, on page 2 you learn functions. On page 3 you learn recursion. On page 4 you learn higher-order functions with lambdas (!!!). On page 5 onwards, you say WTF and can't make sense of anything. The book has only 5 chapters each with a thousand pages. It introduces assignment in chapter 3. Maybe your brain is functional, but my brain is certainly imperative and i need to see what the machine is doing: assigning values, copying memory etc. Teaching higher-order functions before assignment is just backwards in my imperative brain. In the last chapter the book talks about compilers, interpreters and garbage-collection. Is this the same book that started teaching expressions like (+ 137 349)? Now i can understand the last chapters of this book, but only after learning half a dozen programming languages of different paradigms and reading a lot about programming languages and their implementation. I don't know how anyone could follow the pace this book imposes on the reader.

marcus
+1  A: 

You can actually find a full video course of Structure and Interpretation of Computer Programs on Google Video. Start here: http://video.google.com/videoplay?docid=933300011953693438#

The videos were made in the 80's by Hewlett-Packard, and taught by Sussman and Abelson (the original authors). The class is full of HP HW/mechanical engineers who are being retrained as SW engineers. HP released them to the public domain.

Anyone could watch these videos and be a Lisp programmer by the end. Amazing, excellent instructors.

Steve