
On Lisp - luu
http://www.paulgraham.com/onlisp.html
======
nonrecursive
Instructions for printing it with lulu:
[http://www.lurklurk.org/onlisp/onlisp.html](http://www.lurklurk.org/onlisp/onlisp.html)
. I did this about a month ago and the copy I received was great.

~~~
vamega
Just tried to do this, and found that the cover image size doesn't seem
accurate anymore. What did you do for the cover?

~~~
arh68
Really? I just made the book and ordered it last night and the cover (the 13MB
png) looked like it lined up exactly. The first cover-uploader had a 10MB
limit but the other worked fine (not the design-your-own, the 1-piece-cover-
designer).

~~~
vamega
Turns out I was trying to get a hardcover. It worked just fine with a
paperback.

------
yonaguska
I've been meaning to read this for quite some time, but I've been told that
the idioms and coding style is outdated, or not very good. This isn't going to
stop me, but I'd like to know from some experienced lispers what problems I
might encounter. Especially as I'm pretty inexperienced myself. I definitely
won't know what to look for.

~~~
pavpanchekha
It is written to a prior version of the Common Lisp standard, and with a very
old-fashioned style. You'll see calls like (REPLACA pair val) instead of (SETF
(CAR pair) val) and so on. That will irk you if you are a Common Lisp hacker
already. If you're not, just keep in mind that good CL style results in
somewhat prettier code than that in On Lisp.

~~~
yonaguska
I tried reading this back when I started writing lisp- and it's been a year
since. I know I got stuck when I couldn't find functions in slime with C-d
C-h, and just assumed that they were defined by the book. This is much more
reassuring.

~~~
pavpanchekha
REPLACA and its cousin REPLACD are part of the Common Lisp standard, but they
are indeed something you should probably never see. Even for mapping across a
structure or something I'd prefer to write my own inline function. They along
with TERPRI (newline) are the ugliest function names of CL.

------
neurostimulant
Any advice or link for someone new to Lisp like me? Also, is there any good
open source project using Lisp that I can fork/download and tinker with? I'm
still having problem wrapping my head around Lisp. Even implementing some
simple algorithms in Lisp took some time for me.

I think this is due to the fact that I learned to program in C. Nowadays I
work mainly with python/ruby/javascript, but I got the feeling that I could
improve myself as a programmer by learning Lisp.

~~~
eru
You could have a look at the software below Hacker News. It's written in the
Arc Lisp dialect (which itself is implemented on top of the Racket Lisp
dialect).

Apart from Racket, Clojure is also a nice Lisp to get started with. It runs on
the JVM.

I'd advice against learning Common Lisp as your first Lisp these days, even
though Common Lisp is what On Lisp is about.

~~~
pavelludiq
I'd advise exactly the opposite. While clojure and racket are excellent
languages, they are very different from one another and CL. Telling someone to
learn python or ruby if they ask about learning lua isn't a good advice, is
it?

~~~
eru
Oh, if your goal is to learn one of the Lisps, then don't spend any time on
Common Lisp. It's old and ugly.

Similar, if someone asked about a modern scripting language, I'd send them
away from Perl in favour of Python or Ruby.

If they goal was explicitly Perl (or Common Lisp) that would be a different
thing, though.

~~~
serf
>>Oh, if your goal is to learn one of the Lisps, then don't spend any time on
Common Lisp. It's old and ugly.

why?

I don't find that at all, and a large reason for learning common lisp is as a
learning exercise to become more intimately familiar with lambda calculus and
s-expressions. The increased expressivity of clojure (for example) may hinder
the very thought processes that make lisp a dialect worth learning. Of course
they are both fine languages, but most people now advocate the learning of a
LISP not for practicalities sake, but rather just to demonstrate real life
things that those sets of languages do differently than nearly every other
language, and to allow the programmer to take from those experiences and apply
them to their language of choice.

From THAT standpoint, i'd advocate CL first, if not only for forcing the user
of the language to experience the follies of certain practices, such as the
namespace issues that Clojure tried to fix about CL.

~~~
klibertp
> as a learning exercise to become more intimately familiar with lambda
> calculus and s-expressions

Any Scheme implementation will be better for this. Much less primitives, one
namespace for everything, hygienic macros, immutablity by default/encouraged.

CL is exactly the opposite of that - it's complicated because it wants to be
practical. And for the most part it is. It supports procedural, functional and
OO programming, probably logic programming too with the right library. It's
designed as a real system for solving real problems - and as such is not the
best tool for learning about lambda calculus. Actually you could program
imperatively in CL for the long time before ever feeling awkward.

Scheme, with it's mandatory TCO and encouraged immutability is much better for
learning lambda calculus... and about Lisp in general.

------
thurn
What percentage of the techniques in this book are also applicable to Clojure
programming? I don't know a lot about how the two macro systems differ.

~~~
chongli
A fair amount of the examples involve mutation; a practice that Clojure
discourages. A lot of the macros are very instructive, however.

~~~
brudgers
Indeed, _On Lisp_ has an excellent discussion of mutation and its use in
programs written in a functional style. In discussing destructive functions,
Graham describes the ways in which they can be used with reasonable safety -
e.g. immediately mutating a list newly created by a mapping function.

The reasons one might do so in Clojure are likely to bear similarity to those
provided by Graham - speed and memory - despite the vastly greater resources
of today's computers versus those of 1991.

~~~
chongli
Very good point. Mutation is extremely useful when _birthing_ a new data
structure; this is a time when it's not yet visible to the rest of the system
so the danger of sharing intermediate state does not occur. Clojure has a very
elegant facility for dealing with this particular scenario:

[http://clojure.org/transients](http://clojure.org/transients)

------
gernotk
Also take a look on "Let Over Lambda" by Doug Hoyte about advanced macro
techniques:

[http://letoverlambda.com/](http://letoverlambda.com/)

It's a pretty enjoyable book if you don't mind its preachiness. :-)

------
betterunix
Great book, but not if you are just starting out with Lisp. For that, see PG's
other book:

[http://www.amazon.com/ANSI-Common-LISP-Paul-
Graham/dp/013370...](http://www.amazon.com/ANSI-Common-LISP-Paul-
Graham/dp/0133708756/ref=sr_1_1?ie=UTF8&qid=1377483440&sr=8-1&keywords=ansi+common+lisp)

Also make sure you check the errata for On Lisp, there are a few examples that
you will really need the errata for.

~~~
pavelludiq
Actually a much better place to start is Practical Common Lisp:

[http://gigamonkeys.com/book/](http://gigamonkeys.com/book/)

Or if you are now to programming in general:

[http://www.cs.cmu.edu/~dst/LispBook/](http://www.cs.cmu.edu/~dst/LispBook/)

------
damianknz
Cheers to PG for making this available.

------
mark_l_watson
Wowza, it has been 20 years since this book was published. Time goes by too
quickly :-(

------
niuzeta
I thought 'oh, is this a new book'?

Then I looked at the date. It seems as though all 'classical' sources on lisp
or functional paradigm are either two decades old, or just-out-yesteryear.
What happened in between?

------
akavel
Did someone try (and possibly succeed) converting it to epub, by chance?

~~~
edward
[http://www.mbishop.name/post/4113599512/on-lisp-by-paul-
grah...](http://www.mbishop.name/post/4113599512/on-lisp-by-paul-graham-an-
epub-for-your-ipad)

~~~
akavel
thanks! although the diagrams don't seem to work for me, unfortunately

------
javajosh
Has anyone every tried to visualize lisp with a treemap? Maybe that would take
care of the massive indentation problem that makes lisp so hard to read (for
me).

~~~
jdale27
It's 2013, and the top comment on a story about Lisp (on HN, a site written in
Lisp) is complaining about syntax? Seriously, how much time did you actually
spend learning/using Lisp before giving up because it had a "massive
indentation problem"?

~~~
IvarTJ
Surely expressing personal issues with Lisp's syntax is valid, especially if a
possible solution is offered. If you see at least some of the larger codebases
written in Lisp, it is natural to be overwhelmed by the level of indentation,
which will cause the code to wrap under many editor setups.

~~~
jdale27
I've heard people complain about parentheses, but _indentation_ isn't usually
the issue. I challenge you: I looked at your personal website, and you seem to
claim experience in Java and C. Show me a large codebase in Lisp and a large
codebase in Java or C where the Lisp codebase is dramatically less readable
than the Java or C codebase due to indentation.

~~~
javajosh
You seem very upset. Calm down. I just had an idea that it might be fun to
represent lisp code in a treemap. Or rather a zoomable treemap like this:

    
    
      http://bost.ocks.org/mike/treemap/

~~~
heretoo
Perhaps like these?

[http://foldr.org/~michaelw/emacs/](http://foldr.org/~michaelw/emacs/)

~~~
arh68
I very much like the mwe-color-box.el example. Is something like that possible
for backquoting? The quoting-levels would be much easier to see with nested
background shading. I'll have to try it at home.

------
andyidsinga
I think I should read it in emacs ...running on an ec2 instance

------
ceautery
I look forward to reading this, however I object to the first reviewer
comment: "The first book that really explains what Lisp is all about."

No, I think the first book to explain that was Godel, Escher, Bach.

------
systems
OT

how is arc progressing?

~~~
drcode
The Clojure inventor (Rich Hickey) took most of the good ideas from arc and
all the arc enthusiasts have pretty much changed horses long ago to Clojure.

I think arc still has some good points related to code brevity that noone else
has fully duplicated yet.

~~~
arohner
No. Clojure's first public release was before Arc's first public release. Rich
was also working on Clojure for two years before release.

~~~
drcode
I stand corrected.

(and besides, most of the best ideas of Clojure are certainly due to Rich's
insights)

------
unz
Lisp is a dangerous language that shouldn't be taught or used these days.
There are plenty of superior programming techniques.

Mathematical programming - linear programming, finite domain constraint
programming, constraint logic programming, logic programming, relational
programming

Static functional programming - ml, haskell

A good modern introduction to programming is Concepts, Techniques, and Models
of Computer Programming, by Peter Van Roy and Saif Haridi. It's far superior
to the commonly mentioned lisp book Structure and Interpretation of Computer
Programs.

~~~
nickik
What kind of argument is this.

> constraint logic programming, logic programming

The book you comment on actually implments a logic programming system.

Both common lisp and clojure have implmentations of high performance logic
systems.

> Static functional programming

Both Clojure and Common Lisp have type systems that can do most things ml and
haskell can do. Its arguable that some of this (in the CL) are even more
powerful then what haskell has.

Im not sure on what the other types of programming are but the do not at sound
like things that a library can not do. Can you give a example of something
that you can not do in clojure or commen lisp that is possible without in
these other languages that you have not actually provieded.

> Concepts, Techniques, and Models of Computer Programming

It is a very good book. However 99.99% of programming today are not done with
these modern concepts. It are actually langauges like clojure that push some
of the technics like constraint logic programming more into the mainstream.
Check out core.logic.

~~~
freyrs3
> Both Clojure and Common Lisp have type systems that can do most things ml
> and haskell can do.

I don't know about that, Haskell has quite a few very non-trivial extensions
in it's type system that I have yet to see replicated outside of research
languages. ( Rank-N Types, GADTs, Kind polymorphism, etc).

~~~
nickik
See things, like this
[http://en.wikipedia.org/wiki/Qi_%28programming_language%29](http://en.wikipedia.org/wiki/Qi_%28programming_language%29)
or
[https://github.com/clojure/core.typed](https://github.com/clojure/core.typed)

~~~
freyrs3
Both of those projects implement fairly simple type systems, they both even
look simpler than even ML. Having at least outer rank-1 quantification is what
I consider a "modern" typing system.

~~~
nickik
Im not a expoert. But I think at least Qi is as advanced as haskell or ml. The
clojure one is relativly new and not jet full featured.

