Hacker News new | comments | show | ask | jobs | submit login
Ask YC: I started learning Lisp and I'm looking for some advice.
35 points by chez17 on Feb 28, 2008 | hide | past | web | favorite | 26 comments
Hello all. Let me give you a brief background of myself, its important to the post, I promise.

I am a graduate with a CS degree. I didn't really get into programming during college, I enjoyed it, but it wasn't my life like so many other students. I now am getting to the point where its becoming my life (in a good way). I feel like I am really behind in certain areas and no matter what I do, I can't seem to break this barrier and step it up to the next level. I was taught C++ in college but haven't used it once since. I got a job as a web programmer and now work using mainly PHP and Javascript.

I have wanted to take my abilities to the next level for some time but I didn't know how. A friend of mine wanted to start programming so we decided to learn a language together. We narrowed it down to Python or Lisp. I am now learning Lisp and enjoying it, but I don't know how to proceed. It seems every time I try to read a book, the basic stuff is too basic and the advanced stuff is too advanced. I'm in this limbo where I know enough to be a successful web programmer, but know almost nothing of real programming. The ramblings in this message should convey how upset I am with myself. I just don't get it.

I need some advice. I can't seem to find basic lisp projects to get me going. I have even tried to find home work problems on the web just to get something. Books seem to go from "here's a loop!" to "here's a bunch of stuff that we have never covered and now we are throwing it in!" I don't know how to move forward.

Any thoughts and advice would be most appreciated.

Have you read Peter Siebel's "Practical Common Lisp"? [http://www.gigamonkeys.com/book/] Its a great book to learn Lisp from IMO. The pace is just right (for me) and every chapter tackles a truly practical project. Its free online, so you don't have much to lose just to try it.

I have also heard really good things about PG's "On Lisp" [http://www.paulgraham.com/onlisp.html]. Again, its free to download, so you don't have much to lose to try it.

Hope this helps.

I've found Practical Common Lisp to be the best book to get me started with CL. It covers the fundamentals nicely but it does everything in the context of real applications so you walk away from the book having actually built something useful.

As far as problems to start working on, the best way I've found to learn a language is to start making tools/utilities for myself. Then I'd start learning everything I need to implement that particular tool. Pick a task that you wish was simpler or more automated and write a tool to do that for you.

"On Lisp" is excellent but is an advanced text; I would advise against it as a first book. PG's Ansi Common Lisp is pretty good and I use it as a quick reference before I go to The Common Lisp Reference.

It's an excellent text to be sure, but I wouldn't call it advanced. PCL was the the first real Lisp text I read, and I found it to be a superb introduction to the subject.

Just a clarification. I was referring to PG "On Lisp" as advanced. Not PCL. "On Lisp" is mostly about complex uses of macros. Hence the name -- programming "On" lisp instead of programming in lisp

Since you already have a CS degree, take a look at SICP (it's free online). Also, recognize that Javascript is pretty Lispy, and use it to write some kick ass code at work.

When he said the advanced stuff was too advanced I figured he was referring to SICP. When he said the basic stuff was too basic I thought he might have been referring to HTDP.

BRL is some kick ass code. Thanks.

If you're pretty comfortable with your programming chops, want to get up and running quickly, or are planning to do "real-world" programming with Lisp, Practical Common Lisp (http://www.gigamonkeys.com/book/) is great.

Personally, I loved learning Scheme (a dialect of Lisp) from from Structure and Interpretation of Computer Programs (http://mitpress.mit.edu/sicp/), and since it's used to teach CS courses, you can find lots of exercises and project ideas online. If you don't mind a slower, more concept-based learning method, you can supplement your programming projects with this book.

I recommend learning Scheme first. I found "Teach Yourself Scheme in Fixnum Days" to be very readable:


I just wanted to reply and thank everyone for their help. All of you gave me some great links and ideas. Pat your self on the back News.YC, you guys are about as nice and helpful a bunch as you can find on the internet. Thanks.

If your aim is web application, the best way to start may be to first choose your web server. We're using Portable Allegro serve even though it's not as full featured as we'd like. A full featured (but slower) webserver is Huchentoot - which would probably be an excellent choice for starting out. You could then learn lisp by creating a web app - the inductive approach. Also extremely helpful is lispdoc.com where you can run a search on anything lisp and get references to numerous web resources.

My aim isn't only web application, but the idea of rebuilding a site as a tool for learning is a great idea. Thanks so much.

Thanks for the pointer to lispdoc.com. Any idea why it doesn't find Seibel's unit testing chapter when I search for unit test (or +unit +test) (or (and unit test)) (or unit and test) (or "unit test")?

I actually wrote a couple of blog posts on this very topic for the O'Reilly Network which I still believe are probably one of the most extensive collections of links to free resources on the web for learning Lisp. You can read over them here ( part 1 - http://www.onlamp.com/pub/wlg/8397 and part 2 - http://www.onlamp.com/pub/wlg/8595). Also, I've recently gotten back into lisp once again myself--although this time I am going the scheme route--and I am currently reading through R. Kent Dybvig's book The Scheme Programming Language and I'm finding it to be a truly excellent book and it is also free online here http://www.scheme.com/tspl3/. And of course make sure you take a look at the Arc tutorial (http://ycombinator.com/arc/tut.txt) and the blog.arc and news.arc source code as they will have you up and running with a Lisp powered website in no time.

Anyway, good luck with your studies, I think the rewards are well worth the effort. I can honestly say no matter how long I've been away from lisp I always find myself going back and loving it even more each time.

I'm pretty much in the same boat as far as lisp and scheme. I've been reading The Little Schemer and The Scheme Programming language. Both have been really clear books and I've learned a lot from them both that I use at my day job programming PHP/javascript.

The breakthrough for myself as a programmer came from intro CS classes....it may seem odd but I would still recommend going back to the core CS topics of data structures and algorithms, focusing on the implementation - on what kinds of language features might be used to implement these things, and how the language interacts with the hardware. Just pick a promising field of study - encryption, text processing, compression, search, whatever. Choose a common and well-understood algorithm in that field, do all the research you can, implement it, and then try writing something around it.

The key for me was to have some code of a non-trivial complexity to play with. This would be something that you would be willing to rewrite four or five times and really master. Having an interesting application in mind helps one get there, but one can often flip states between "interesting app" and "interesting problem" in programming.

It's not in vogue nowadays, but Knuth's Art of Computer Programming is chock-full of this kind of "programming exercise" and it makes a pretty good reference too.

I would suggest The Little Schemer to understand the concepts of Lisp/Scheme. I would read and digest this before any other lisp book. The book appears to be an easy read but it is not. Practical Common Lisp lives up to its name and has some very good examples/projects intermixed with lessons. Be prepared to spend a lot of time manipulating, breaking down and refactoring code (for macros use macroexpand-1). This is exactly what you need to do when you get that lost feeling. The best thing about lisp/scheme is that the interpreter is always available to you to test and environments like slime or allegro IDE which allow interaction between the editor and interpreter. Also checkout lispcast (http://www.lispcast.com/)

I have not had that experience myself as I am pretty happy with the lisp books I have read. Maybe it's because I took lisp courses in undergrad, and then worked on projects where my figuring things out was driven by specific projects. I would recommend possibly a video course, and following like a real course, doing the work, and then coming up with a project where you apply it. Here is a free video course from MIT following the classic textbook, which is also available for free online http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-le...

I went through the same as you (except replace PHP with C#), so here's what I did. It echoes a lot of the thoughts mentioned already:

To learn "lispiness", functional programming, and get a feel for the computational approach to programming, read The Little Schemer and The Seasoned Schemer. Also watch the SICP lectures (http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-le...) and if you're ambitions, read the book (http://mitpress.mit.edu/sicp/). Doing these things will help keep you from writing PHP in Lisp.

To put it into practical perspective and learn the nuts and bolts of modern common Lisp, read Practical Common Lisp (http://www.gigagmonkeys.com/book).

If you read PCL, you will run into Emacs and SLIME (the generally preferred [NO FLAMES, PLEASE. I KNOW VI IS AWESOME TOO] open source way to edit Lisp files). I wrote some resources to help with that:



I'm surprised no one has mentioned PAIP (Peter Norvig's Paradigms of Artificial Intelligence Programming). It's half AI book, half tutorial on Lisp programming and Lisp style. It's a good read with lots of example programs written in good Lisp Style.

There are three hurdles people usually run into when learning Lisp:

a) the language looks different - this goes away with practice and familiarity. It starts looking normal fast. The parentheses are a bit tough to manage unless you use a capable editor, which leads to:

b) Emacs is different - really powerful, fun to use, but it takes investment in learning. It's really tempting to quit when starting, but worth getting over the hump. Once you do that:

c) the way of thinking is different in Lisp - Lisp seems a little awkward to use until you get (don't need to master them, just get the idea) the following ideas: 1) code can be manipulated as data because the syntax is so simple, 2) creating your own syntax (using macros - code that writes code) means that you can express your program in a way that closely matches the problem you're trying to solve. Some good articles to help get these points are:



Don't worry if you don't get these "big picture" things at first, they click at some point and everything makes a lot more sense. You can speed that up by putting a lot more Lisp in your head in the meantime.

Good luck!

thank you! One of the best advices I've ever read on Lisp. Once again, thank you.

The Common Lisp Directory has a list of online resources (tutorials, references, books, blogs, etc.) here: http://www.cl-user.net/asp/tags/information

Take a web application you like and rewrite it in Lisp. Or better yet, take one that you wrote in PHP and rewrite it in Lisp. Nothing else beats the knowledge you will gain working this way.

In order to truely benefit from this, you'd have to ensure you're not just translating the PHP into Lisp.

Build something you've built before - just do it in Lisp. Read up on what others have recommended here as you go.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact