开发者

Would Lisp be extremely difficult for a new(ish) programmer to learn? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 3 years ago.

开发者_如何学C Improve this question

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


Get SICP (Structure and Interpretation of Computer Programs). It was the entry level CS class textbook 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.


Given some good books, websites, and some time, would it be particularly difficult to learn either Common Lisp or Scheme?

No.

Which of the two would be easier?

Scheme, because

  • It has better books for beginners.

  • It has a superb interactive programming environment designed for people who are just learning the language.

  • It is smaller.

How do they compare with Python and C, as far as ease of learning?

I think it's harder to learn C than to learn either Python or Scheme, because to learn C you really have to grok the machine model, pointers, and dynamic memory.

Between Scheme and Python, it is really hard to predict how any individual learner will react. I really like Python's significant whitespace, and I find Scheme's parentheses annoying and distracting. Lots of people really like Scheme's parentheses, and they find Python's significant whitespace annoying and distracting. (There are important semantic differences, but it is hard to escape the tyranny of syntax.)

What books should I use? (question you should have asked and didn't)

Don't use Structure and Interpretation of Computer Programs (SICP). That book's point of view is "let's show off how smart we are by coding all of computer science in Scheme." The book is a tremendous intellectual tour de force, but it is not at all suitable for beginners. When MIT used it in 6.001, it was as a "weedout" course because 30–40% of all MIT students wanted to major in EECS, and they were trying to turn people away. SCIP is a terrific for a senior CS student or a programmer with 5 years of experience. Don't try to learn from it.

Some good books to learn from:

  • How to Design Programs by Felleisen et al has been carefully crafted and honed through years of experience. It uses Scheme and teaches you exactly what it claims in the title. Highly recommended.

  • Simply Scheme by Harvey and Wright is an introductory CS book by people who felt that SCIP needed a "prequel." I enjoyed reading it but I haven't taught from it.

  • If you can stand cuteness, The Little Schemer by Felleisen and Friedman has a very unusual dialectical style, with tons of examples, that you might like.


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.


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.


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.


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.


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.


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.


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'!


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.

You can currently find them here: https://archive.org/details/ucberkeley-webcast-PL6879A8466C44A5D5


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜