top | item 8016950

Learn Lisp the Hard Way

190 points| wes-exp | 11 years ago |learnlispthehardway.org

141 comments

order
[+] thephoeron|11 years ago|reply
Wow. The response on here has been amazing---yes, the criticism too. I was really shocked last night with the spike in traffic from Reddit, but I had no idea what to make of getting to the front page of Hacker News. TBH, I'm feeling pretty overwhelmed about the whole thing.

Just to put my two cents in, as a general reply to a lot of comments here... this is a very, very early draft in progress, and I didn't expect anyone to pay attention to this project, let alone post it everywhere. It needs a lot of work, particularly in toning down the Lisp Evangelism, and staying true to the methodology without accidentally parroting Zed Shaw's voice.

Zed Shaw: it means a lot to me to get your perspective here. Yes, you and your series ultra-inspired me. I've wanted to write a book on Lisp for a long time, but it wasn't until I was pointed to your series that I felt like I could give Lisp the perspective it was missing. I'll make a point of editing the Preface more carefully---everything that's up there so far, I wrote off the top of my head with very little editing, so I guess in following your method and format I accidentally used some of your words as well.

Thanks everyone!

[+] zedshaw|11 years ago|reply
I really hope Colin finishes this as I've always thought Lisp would be a better beginner language if there was a book like mine for it. You've either got "The Little Schemer" series, which is annoyingly written for little kids but close to the style, or you have giant academic tomes that only hard core geeks would bother reading. A "trainer" book like mine would definitely solve this gap.

The intro is a little bit copied but it's fine since he is keeping to the idea and the "rules" I have, but could be nicer if it was in his own voice more. Who knows, maybe he does write like me a lot or he's just ultra inspired.

The big reason I say people should use their own words, apart from copyright, is that if you're writing one of these books for a programming language you love then your words will express that better. You'll say things that come from your community and culture, and you'll give away a sense of what you like about that language. When people copy what I say the prose comes out obviously not by them and not for that language.

Anyway, this is pretty cool and I hope he works on it some more.

[+] taeric|11 years ago|reply
http://landoflisp.com/ is a nicely informal book on learning lisp that is easy to get into. Pretty sure I've seen it highlighted here a few times.
[+] vilhelm_s|11 years ago|reply
I don't think The Little Schemer is intended for young kids. The preface says

> The Little LISPer is based on lecture notes from a two-week ``quickie'' introduction to Lisp for students with no previous programming experience and an admitted dislike for anything quantitative. Many of these students were preparing for careers in public affairs.

I don't know exactly what that means, but it sounds university-level?

[+] correnos|11 years ago|reply
Practical Common Lisp is a very good introduction. It's very much targeted at competant non-academics.
[+] bestrapperalive|11 years ago|reply
"The mysterious force driving human society towards the technological singularity, true and total unification of human with technology, also seems to be shaping all programming languages into Lisp, and all computers into Lisp Machines. Lisp, after all, can do everything, and do it every way; that Lisp is not already the de-facto programming language is just a reflection of the state of the world as a whole—only a very small percentage of the population are excited for the technological singularity, but the singularity is coming no matter how much people complain. One way or another, every programmer is going to end up being a Lisper, because every programming language continues to adopt features and syntax from Lisp, one piece at a time. It is in every programmer's interest to master Lisp now, before the world at large realizes how essential Lisp will become over the next two decades."

The title is right, IMO. This is a difficult way to learn Lisp. I'm feeling the burn already.

[+] AnimalMuppet|11 years ago|reply
That burn isn't from Lisp, though. It's from this author's tying Lisp to a somewhat far-out world view - one that doesn't actually relate to Lisp very much.
[+] danso|11 years ago|reply
I can't bag on a free book, one created as a labor of love...but if I had to make a suggestion, it would be to tone things down a bit:

http://learnlispthehardway.org/book/preface/

> The biggest secret to Lisp is that it is actually the simplest programming language ever created—and that, coupled with its expressiveness and elegance, is why it is favored exclusively by the best programmers in the world.

As a Lisp novice...my thoughts are, "Really?" to both of those assertions. Because the natural follow up is..."So if all the best programmers use it, whatever "best" means, why is it a language that seems so rare in everyday use?".

No need to assert things you can't actually prove or show...it just builds up skepticism before the reader even starts learning. Just talk about the language at hand, or at the very least, do a quick Rosetta Stone comparison of Lisp doing something much more simply than Python/Ruby/PHP, and that's all you need to write in the intro.

[+] kazinator|11 years ago|reply
An easily overlooked, seemingly forgotten book that is great for newbies is Stuart Shapiro's _Common Lisp: An Interactive Approach_.

I stumbled into Lisp some fourteen years ago when a hard copy of the book landed my way.

The book is now freely available in electronic form (and has been for years): http://www.cse.buffalo.edu/~shapiro/Commonlisp/

[+] melipone|11 years ago|reply
That was my first Lisp book 30 years ago already.
[+] meowface|11 years ago|reply
I have nothing against Lisp, but...

>Is Lisp as hard as people say it is?

>No. Lisp is actually the simplest programming language, and has no syntactic cruft.

I always see this used when claiming certain languages are easy to grasp. "It's not complex at all! The syntax is incredibly simple!" x86 assembly also has very simple syntax but it's not too easy for beginners to write in, beyond very simple and small programs.

[+] kazinator|11 years ago|reply
The syntax of assembly language isn't combinative, beyond simple catenation. You're not creating trees, just a "link sausage" (or, a graph, more accurately) of instructions. Lisp syntax expresses tree structures; it actually does what other languages achieve with complicated syntax. They have parsers which build trees out of nodes. Those trees can be written in a Lisp-like way. E.g. a C declaration might be turned, by a C compiler, into (declare specifiers-qualifiers declarators), where specifiers-qualifiers might look like (const int) and declarator might be (a (pointer (array 3))), giving us (declare (const int) ((a (pointer (array 3)) (b (pointer (function (a int) (b int))))) for the surface syntax "const int (a)[3], (b)(int, int)". It's not just that the syntax is simple, but that it can capture the structure of programming (and other) languages while remaining simple.
[+] spain|11 years ago|reply
It really is. That's why they used Scheme for the Structure and Interpretation of Computer Programs (SICP). If you look closely at it, you'll notice that they don't actually spend a lot of time teaching you anything about language itself, just the processes.
[+] mushishi|11 years ago|reply
From the FAQ: "Is Lisp as hard as people say it is?

No. Lisp is actually the simplest programming language, and has no syntactic cruft. While it wasn't designed to be “easy to learn” like Swift, Python, Ruby, or Basic, there is less overall to learn and you will be writing real, useful programs in Lisp sooner than you could with other languages."

Is it necessary to put strong subjective statements that have no supporting links or proof? Also, are you seriously saying that /Common/ Lisp is the simplest language? (from FAQ: "Lisp — the friendly nickname for Common Lisp")

[+] slapresta|11 years ago|reply
Syntax wise, it is probably the simplest language as long as you don't include Turing tarpits.

Of course, simple syntax is nice, but it doesn't actually get you very far by itself.

[+] krapp|11 years ago|reply
Ok i started this. How long before I can condescend to the rest of you barbarian peons?

But seriously - i've been wanting to learn a lisp for a while now and this seems like an accessible way to go about it.

[+] mkautzm|11 years ago|reply
"Is Lisp as hard as people say it is?

No. Lisp is actually the simplest programming language, and has no syntactic cruft. While it wasn't designed to be “easy to learn” like Swift, Python, Ruby, or Basic, there is less overall to learn and you will be writing real, useful programs in Lisp sooner than you could with other languages."

It's like a never-ending stream of lies, every word being a little more absurd than the last...

[+] wes-exp|11 years ago|reply
Just because Lisp looks foreign doesn't mean that it's harder. The syntax is different, but it is also very simple. If this were untrue, Scheme wouldn't have survived as a teaching language all these years.
[+] AnimalMuppet|11 years ago|reply
Well, let's see.

Lisp has no syntactic cruft? It has (almost) no syntax, so there's less room for cruft. That said... cons? car? cdr? That's your syntax? That's not cruft? Seriously? There may be less total cruft, but the percentage of cruft might still be higher...

There's less overall to learn? If you mean to master the syntax, sure, that's true.

You'll be writing real, useful programs in Lisp sooner than you could with other languages? That's a much more arguable point. There's more to being able to effectively program in Lisp than learning the syntax (as there is for every language). Is that "more" easier to learn for Lisp than for other languages? I have no data, but for the web site's claim, I'd at least say "citation needed".

[+] terminus|11 years ago|reply
> It's like a never-ending stream of lies, every word being a little more absurd than the last...

It's been my experience that most things are tractable once you spend long enough staring at them.

If you care enough about a subject to have strong sentiments like "never-ending pack of lies" then your time would perhaps be better served by spending time with the "adored" object, rather than these comments.

[+] JasonFruit|11 years ago|reply
Could you enumerate the lies for us? Your comment is arresting but not enlightening without more information.
[+] nilved|11 years ago|reply
I think the sentence is poorly put together, but there aren't any lies. Clojure syntax is by far more simple (and thus easier to learn) than C-style languages or Python or Ruby. But the language is harder to jump into because it places particular emphasis on programming principles that are confusing to new programmers, like function purity, recursion and higher-order functions.

Keep in mind too that different Lisps have different syntax. The only thing in common between them is Polish notation, S-expressions and a macro system. A Clojure program and a Common Lisp program look and feel very different.

[+] jfarmer|11 years ago|reply
"simple" isn't the opposite of "hard," it's the opposite of "complex."
[+] jflowers45|11 years ago|reply
I went to a techie high school and we studied LISP in an AI class I took. My biggest memory is the load of parentheses! It was definitely an interesting language and I've often thought about looking back at it for giggles. This could be a good reference.
[+] Kluny|11 years ago|reply
The FAQ section answered all of my questions. Well done.
[+] terminus|11 years ago|reply
I'm guessing this was posted earlier than expected. Don't see much content beyond the Preface.
[+] meenzu|11 years ago|reply
This is fantastic! Really looking forward to the web chapter!
[+] anmonteiro90|11 years ago|reply
OK. this is actually true. thank you so much
[+] jaekwon|11 years ago|reply
What is that background image? Some fractal?
[+] code_chimp|11 years ago|reply
thephoeron should start a mail list to let us know when there are updates and when the paperback is ready to buy.
[+] Udo|11 years ago|reply
"that Lisp is not already the de-facto programming language is just a reflection of the state of the world as a whole—only a very small percentage of the population are excited for the technological singularity, but the singularity is coming no matter how much people complain."

As a transhumanist myself I resent the arrogance that led to this ridiculous appropriation. Yes, Lisp is pretty great, but the use of other languages is not some grave cultural defect through which you can glimpse at all the badness in the world.

If the goal here is to evangelize Lisp, radiating this kind of pomposity seems like a questionable move because it reflects badly on the community you are trying to win new members for. Worse, this could be interpreted as willful cluelessness in the face of the rich multi-language ecosystem potential readers are living in.

As far as the singularity is concerned, monocultural boneheadedness is not something people associate with technological progress.

[+] steveklabnik|11 years ago|reply
I love various Lisps, but I've always enjoyed http://james-iry.blogspot.com/2009/05/brief-incomplete-and-m... :

    > 1958 - John McCarthy and Paul Graham invent LISP. Due to high costs
    > caused by a post-war depletion of the strategic parentheses reserve LISP
    > never becomes popular[1]. In spite of its lack of popularity, LISP (now
    > "Lisp" or sometimes "Arc") remains an influential language in "key
    > algorithmic techniques such as recursion and condescension"[2].
[+] kazinator|11 years ago|reply
Ignorance of things like Lisp is a cultural defect in computer science. It's just a symptom of a greater problem: lack of awareness of what has already been done by prior generations. If electronics engineering were like CS, some twit would be reinventing the long-tailed differential pair today, and trying to get a patent on it, with full backing from his research institute or employer.
[+] fisher-lebo|11 years ago|reply
There's a lot of religious imagery in the text with discussion about fractal cosmology, mysticism, Lisp's natural connection with the human mind, etc.

It seems as though the author is trying to sell a religious experience to his readers. If that is the case, that's interesting in the sense that it is certainly unlike any other programming text I've read. I personally think evangelizing Lisp should be in the form of making it more familiar, human, and relatable to the average programmer, but I can't help but to respect the sheer uniqueness of the approach.

[+] dropit_sphere|11 years ago|reply
>If the goal here is to evangelize Lisp, radiating this kind of pomposity seems like a questionable move because it reflects badly on the community you are trying to win new members for. Worse, this could be interpreted as willful cluelessness in the face of the rich multi-language ecosystem potential readers are living in.

How circular! A Lisper would respond that the very passage you critiqued is the appropriate response to your critique---that Lisp is coming, no matter the tone, and our complaints or praises will have no effect on the final outcome.

Perhaps Lispers would do well to be less pompous, but that is for their welfare, not Lisp's.

[+] jschulenklopper|11 years ago|reply
Before asking the obvious question when noticing the "Learn [X] The Hard Way" pattern, the FAQ already addresses that :-)

Q: Is this site affiliated with Zed Shaw and Learn Code The Hard Way?

A: No. This is a separately run and managed site, based on the format of Zed Shaw's LxTHW open-source package [1] for writing your own programming language course. You should check out the project and see what others are up to! More information is available at: Learn Code The Hard Way [2]

[1] https://gitorious.org/learn-x-the-hard-way/

[2] http://learncodethehardway.org/

[+] zedshaw|11 years ago|reply
It's not affiliated with me other than using my starter kit and the title style.

I do support books like this as I think there needs to be more "trainer" style books, especially for beginners, because they work.

[+] andrewstuart|11 years ago|reply
Why copy his format? Seems Zed did the hard work to establish the brand.
[+] scottlocklin|11 years ago|reply
"Lisp is, at its heart, a very mystical language, that blurs the line between programming and magic."

I like lisp, but this kind of mystical gobbledeygook is not helpful. It's worth noticing that mystics and lisp-ninnies are alike in a very important way: promising much, and delivering little. The people who actually accomplish things in lisp (Yann LeCun, Richard Fateman) do not speak in this preposterous mouth foamy way. They also don't work for overt frauds like d-wave.

[+] enupten|11 years ago|reply
Yann leCun does not use Lush anymore.