
Learn Lisp the Hard Way - wes-exp
http://learnlispthehardway.org/
======
thephoeron
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
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
[http://landoflisp.com/](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.

~~~
serf
I like Land of Lisp, and I own the ebook+paperback, but I don't think that
it's well suited to beginning programmers. I think the "let's make a game"
approach actually works better for programmers who are coming from a different
language and trying to understand concept translations, rather than novel
concepts themselves.

edit : I can't reply to you, but re-read what I said. I am making the point
that I believe Land of Lisp to be for people coming from other languages,
whereas I think that "learn X the hard way" is better for people new to
programming altogether.

The parent of my reply is pointing out to zedshaw that "Land of Lisp" is a
good beginners book. I am adding that it's my opinion that it's a good
"beginner at lisp" book, and not an overall "good-for-beginner-programmers"
book.

~~~
binarycrusader
Uh, the land of lisp has the let's make a game approach as well. I'm not sure
I understand what aspect you're talking about.

~~~
binarycrusader
I'm not sure why my comment was downvoted, but having read and gone through
over half of the Land of Lisp personally, I can factually state that it does
indeed have multiple game exercises involved.

To quote from the book page:

    
    
      Along the way you’ll create (and play) games like Wizard
      Adventure, a text adventure with a whiskey-soaked twist,
      and Grand Theft Wumpus, the most violent version of Hunt
      the Wumpus the world has ever seen. 
    

[http://www.nostarch.com/lisp.htm#toc](http://www.nostarch.com/lisp.htm#toc)

If someone would like to argue that it does not have a "game approach", I
would like to see the specific reasoning as to why.

------
bestrapperalive
"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
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
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/](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
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/](http://www.cse.buffalo.edu/~shapiro/Commonlisp/)

~~~
melipone
That was my first Lisp book 30 years ago already.

------
krapp
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.

~~~
krapp
welp apparently i'm done for now...
[http://learnlispthehardway.org/book/1-02-02-more-
strings/](http://learnlispthehardway.org/book/1-02-02-more-strings/)

~~~
thephoeron
Restarted the server, you should now be able to see the next three
exercises... although there's very little to be seen in them so far.

------
meowface
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
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.

~~~
cma
You still end up with myriad syntax rules; why (a int) and not (int a)? Why
not any inversion or isomorphic transformation?

------
malisper
I'm surprised there is no mention of Lispbox[0], by far the easiest way to set
up Common Lisp.

[0] [http://common-lisp.net/project/lispbox/](http://common-
lisp.net/project/lispbox/)

~~~
guiomie
Awesome, I'll give this a try. Does it use Steel Bank Common Lisp ?

~~~
FatalBaboon
They wrote that they use "Clozure Common Lisp compiler" [1]

[1] [http://ccl.clozure.com/](http://ccl.clozure.com/)

------
mushishi
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
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.

------
mkautzm
"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
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.

~~~
mkautzm
It's less about it being 'foreign' and more about it being totally unparsable.

The thing with imperative programming is that you don't really need to know
the language to at least get an idea of what's happening.

Lisp is so dense that while you can pack an unbelievable amount of programming
into a small chunk, approaching it as a beginner is daunting. There isn't a
really good way to 'build' on an algorithm and learning it is significantly
harder than learning C# or Java or even better yet, Python.

It's like saying, 'Linux is easy to learn! You can do so much in so few
characters! It's so powerful! And look, robust manual pages for all!'

Yeah, that's true, but handing a user some pipes and greps isn't going to
explain what the hell they actually do or better yet, how to leverage that
into something useful. It's just going to look like greek to anyone who sees
it and a huge effort has to be made to get to the point where you can even
begin to understand what's happening.

Imperative programming doesn't ask you of much. 'Here is a class. Here is the
main method. Write some stuff in here. Here are some basic methods in the
default libraries and their expected inputs. It's going to execute line by
line. Go nuts.'

And that's really the difference here. Lisp asks a lot of the user up front.
Python doesn't. C# doesn't. Fuck, Python is so loose that you don't even
really need to know what any of the structure is to start writing something
that kicks back some output. Yeah, as a group that understands Lisp and Scheme
and Haskell and F#, it's really easy to say, 'Lisp isn't THAT hard', but
that's bullshit. Lisp IS that hard. Lisp is a very difficult language to
pickup when you are starting at square one and it's only marginally easier if
your background is purely imperative languages. Misrepresenting that is a
bold-faced lie.

~~~
agentultra
How much of your argument is cognitive bias?

From what I understand the hardest thing to teach new programmers coming to
Java or Javascript or even Python is assignment and mutability. That has a
huge cognitive overhead.

Contrast that with the lambda-form structure and substitution method of
evaluating expressions in Lisp.

    
    
        (function arg1 arg2...)
    

It's consistent and simple. You can introduce mutable variables and iteration
later. With just the substitution method you can go very far as demonstrated
by Gerald Sussman in the SICP lectures.

You color your argument with a preference for imperative programming by over-
simplifying Java; arguably one of the more difficult languages to teach
beginners. The venerable, "Hello, world!" exercise is an illustrative example.

Again contrast that with:

    
    
        (format t "Hello, world!")
    

I think it is possible that Lisp is not that hard to teach as we're meant to
believe by arguments like this. Java is a fine language but it requires a fair
amount of expertise to use effectively. The same can be said of C. Python and
other dynamic languages of the sort might come close to lowering the
"difficulty" bar but I wouldn't discount Lisp just because it seems foreign to
you.

~~~
PuercoPop
You could even just write "Hello, world!"!

------
jflowers45
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
The FAQ section answered all of my questions. Well done.

------
terminus
I'm guessing this was posted earlier than expected. Don't see much content
beyond the Preface.

------
meenzu
This is fantastic! Really looking forward to the web chapter!

------
anmonteiro90
OK. this is actually true. thank you so much

------
jaekwon
What is that background image? Some fractal?

------
code_chimp
thephoeron should start a mail list to let us know when there are updates and
when the paperback is ready to buy.

------
Udo
" _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.

~~~
kazinator
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.

~~~
Udo
That's not the issue. It's about whether you think that Lisp is the only
objectively correct answer whenever the question arises "what language are we
going to use for this?".

Willful ignorance about other languages and their features is as much a
cultural failure as, the hypothecial, unwillingness to learn about Lisp.

~~~
FatalBaboon
The point is that other languages added little to what Lisp already had to
offer over half a century ago.

Every language has its use, but really we ARE wasting time by splitting the
worldwide community of programmers in different languages.

Look at how most programmers love one language and advocate it's the best
there is. That's called a split.

Aren't we supposed to not reinvent the wheel?

~~~
Udo
This view only makes sense if you believe one language is enough. One language
that has it all figured out, one language that is the right solution for _any_
task.

Even if such a language existed (be it Lisp or not), which is unrealistic,
there is still a second aspect to the whole thing: programmers' brains.
Different languages map differently to different kinds of brains, and that's a
very good reason to explore multiple concepts in itself.

The Split is the natural way to explore a large search space using different
strategies. It happens all over nature, and it's the way human-powered
research works as well. Monocultures don't perform nearly as well. Yes, there
is some effort wasted, but you can rarely ever come to an objective consensus
where this waste actually occurs - except, typically, in hindsight.

Also, there is quite a bit of cross-pollination of ideas happening among
different environments and languages, so advantageous traits do get passed
around beyond their initial ecosystem.

I imagine cross compilers and common runtimes will get more popular, too, now
that we have the processing power - and that's also a good strategy do
deduplicate effort.

The only thing that really strikes me as a bad strategy is militantly
advocating one programming language as the master race. You're not even doing
the "pure" in-community a favor by denying that concepts from the outside
world might occasionally be useful. Instead members are reduced to armchair
criticism along the line of "yeah, nice library, but you didn't write it in
Lisp, so at the end of the day nothing at all was achieved."

~~~
kazinator
One language might not be enough, but one nice language _plus C_ \--- now
you're talking. :) :)

------
jschulenklopper
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/](https://gitorious.org/learn-
x-the-hard-way/)

[2] [http://learncodethehardway.org/](http://learncodethehardway.org/)

~~~
andrewstuart
Why copy his format? Seems Zed did the hard work to establish the brand.

~~~
ambiate
Why would he put up a public repository if he did not want the format copied?

Zed A. Shaw created project Learn X The Hard Way 2011-08-29 22:06:48 UTC This
is a skeleton book project that makes it easier to start working on a "Learn X
The Hard Way"...

~~~
ProAm
I think you can copy his format, but taking his brand is a different story.
Zed put a lot of hard work into that, this is less than honest in my mind.

~~~
AnimalMuppet
Saying that it's a template for a "Learn X The Hard Way" book sounds to me
like an invitation to write a book titled "Learn X The Hard Way" (absent any
statement on his site asking that people name their book something different).

------
scottlocklin
"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
Yann leCun does not use Lush anymore.

------
PuercoPop
Regarding the tone I concede it is a little over the top, but considering the
author works for D-Wave[1] building the future of (Quantum) Computing I think
it is not without merit.

It may be better to leave the intro part for the end as it may alienate
programmers that have preconceived notions about lisp based on hearsay and not
actual experience (i.e. it's enlightening, it's old, full of cruft, hard to
read, it's functional, Clojure is the future of lisp).

It is also very much a WIP that the author didn't submit so keep that in mind.

I hope he gets to writing the chapter on Quantum computing:
[http://learnlispthehardway.org/book/3-14-0-quantum-
computing...](http://learnlispthehardway.org/book/3-14-0-quantum-computing/)

[1]: [http://www.dwavesys.com/](http://www.dwavesys.com/)

~~~
thephoeron
It's worth noting that I don't work for D-Wave. Quantum Computing is an
interest of mine, so naturally I signed up for their developer program when
they launched it a couple years back (which they shut down entirely earlier
this year).

~~~
PuercoPop
Sorry, my mistake. Don't know where I got the idea that I had seen D-wave on
your gh profile.

~~~
thephoeron
Oh, yeah that was just the group for members of their developer program. It's
gone now though.

