
Paradigms of Artificial Intelligence Programming (1992) - lispm
https://github.com/norvig/paip-lisp
======
nabla9
This book is timeless classic that is not getting old.

It's basically two things:

* Learn to program book written in very basic old school Common Lisp. Or, learn to program after you already know how to program. If you never really dwell deeply into code that others write to improve your own skills this is good book so start. It's programming as art or literature.

* Overview of some old AI techniques, interpreters and parsers. Old AI techniques are today's good to know heuristic algorithms.

------
SloopJon
Peter Norvig is probably my favorite online teacher, from the AI class in 2011
to his Design of Computer Programs on Udacity. His attitude is inviting, and
his exposition clear.

The kerning in the PDF looks weird on my Mac, but it's really cool that this
is available.

~~~
lispm
Please check again, now there are better PDFs in the repository.

------
eliben
Wow, it's great this book is now available online for free!

It's definitely one of my all-time-favorite programming books - my own copy is
well worn by use. It's not exactly cutting edge AI in 2018, but the general
programming advice is timeless and the AI samples can be seen as a fun domain
to play in.

~~~
zandomatter
Based on the repository description I thought it was just the code examples,
but wow yeah it's the whole thing.

------
stevelosh
This book is excellent. The AI stuff might be a little dated, but if you've
read some intro to Common Lisp books and want to learn more about how to use
the language, this is a great place to dive in.

As someone mentioned, this particular scan/OCR has some wonky kerning. If you
happen to be an ACM member with access to their library there's a much nicer
PDF available there.

~~~
rasur
This is heartening news - I bought the e-book of PAIP a while ago, and the OCR
in it is horrible, with many errors (although perhaps they were deliberate, to
keep readers on their toes?).

~~~
lispm
Please check again, looks like there is a new version.

------
jimbokun
My favorite programming book.

The chapters on performance tuning are timeless. Following Norvig’s thought
process on how to develop computer programs is like pair programming with one
of the best programmers of all time.

~~~
nextstepguy
Only second to the SICP book, but yeah, I agree. Fantastic read and timeless
advices.

------
avmich
Was slowly re-reading the paper version looking for the particular phrase :) .
Search in electronic version got it quickly... but it's still cool to read the
book, even though author recommend to go to "AI: modern approach".

The quote I was looking for (found when reading the book earlier, then forgot
the exact place):

"To put things in perspective, consider that Lisp is at once one of the
highest-level languages available and a universal assembly language. It is a
high-level language because it can easily capture data, functional, and
control abstractions. It is a good assembly language because it is possible to
write Lisp in a style that directly reflects the operations available on
modern computers."

~~~
Molaxx
Is there any example of this assembly style of programming in Lisp?

~~~
sedachv
Any time people claim that Lisp is a functional programming language, I like
to drag out this example posted by Joe Marshall to comp.lang.lisp[1]:

    
    
        (DEFUN RDSYL (L DF)
          (PROG (LL BRAKP ANS CH)
                (SETQ DF (MERGEF DF '((* *) * *)))
             AA (SETQ LL (SETQ BRAKP () ))
              A (SETQ CH (OR (CAR L) #/_))
                (COND ((OR (= CH #/ ) (= CH #//))     ;"/", " "
                       (POP L)
                       (SETQ CH (CAR L)))
                      ((AND (= CH #/[) (NOT #%(ITSP)))    ;"["
                       (SETQ BRAKP 'T))
                      ((AND (= CH #/]) (NOT #%(ITSP))) (SETQ BRAKP () )) ;"]"
                      ((OR (= CH #/( ) (= CH #/) )) (RETURN () ))  ;Cant have parens here
                      ((= CH #/,)     ;Comma
                       (COND ((NOT BRAKP)
                              (POP L)
                              (GO RET))))
                      ((= CH #/_) (GO RET)))
               (PUSH CH LL)
               (POP L)
               (GO A)
          RET  (SETQ DF (MERGEF (NAMELIST (MAKNAM (NREVERSE LL))) DF))
               (SETQ ANS (NCONC ANS (LIST DF)))
               (AND (= CH #/,) (GO AA))
               (RETURN ANS) ))
    

There is a lot of this kind of code around in the various Lisp Machine sources
(CADR is legally available for poking around in[2]). Occasionally things like
this pop up in contemporary Lisp compilers or IO/concurrency libraries. Some
algorithms are much easier to express with _goto_.

[1]
[https://groups.google.com/forum/#!msg/comp.lang.lisp/4nwskBo...](https://groups.google.com/forum/#!msg/comp.lang.lisp/4nwskBo3FR0/cmVlCio6s64J)

[2] [http://www.unlambda.com/cadr/](http://www.unlambda.com/cadr/)

------
kruhft
One of the best books on programming there is. Every time I get the gumption
to work on one of the chapters from this cookbook, I always learn something
new.

:+1:

------
zerr
I've lightly skimmed this book in the past and got an impression that it is a
collection of intros to bunch of subjects. For those who read it thoroughly -
do you think this book is useful for experienced devs who are
aware/knowledgeable (from other sources) in most (or all) of the subjects
mentioned? Or maybe this book is aimed for more beginners, e.g. as a second
book after SICP or similar?

~~~
abecedarius
I had the same impression when it first came out and I dipped into it in the
bookstore a couple times: it looked like a good treatment of a bunch of topics
I'd mostly already been introduced to.

This misses what I found most valuable when I did get around to it. There's
another thread up on HN right now, "Nobody's just reading your code". Back
then I read a lot of code from books, and read more actively by treating it
like a reviewer: how could this code be clearer or otherwise better, how else
might you do it? Most of the time, in many other books, you wouldn't get far
before seeing some clear improvement. In PAIP this basically never happened.
Often enough I would think of something, but if you worked it out in detail
there was some less-obvious reason the code was the way it was. At one point I
spotted a bug, and he wrote back that it'd been a year since the last bug
report, and he'd started to hope there weren't any more.

All the code in the book is pretty short, and it's not really "production
code", but it's enough to be an education in craftsmanship at every level. I
found that more interesting than the object-level topics, though they're worth
learning about too.

Nowadays if you prefer Python you can get a similar experience at
[https://github.com/norvig/pytudes#pytudes-index-of-
jupyter-i...](https://github.com/norvig/pytudes#pytudes-index-of-jupyter-
ipython-notebooks) treating different examples.

One more personal reaction I had to this book: feeling like here was someone
else with some of the same values. (Only, you know, smarter.) Someone with a
similar taste, who couldn't resist coming back to their code repeatedly well
after it's "done". The work in the end looks pragmatic, but sort of an
idealized pragmatism: you have to really want to produce your best work, to
work that hard over it.

~~~
zerr
pytides looks interesting. I wonder if he ever produced (or worked on) a
similar material/project using statically typed traditional languages.

~~~
abecedarius
He cowrote a Scheme interpreter in Java -- you can find it on his webpage.
There are some projects from others on implementing algorithms from AIMA in
other languages, such as this one that just came up in my feed the other day:
[https://github.com/MrDupin/aima-go](https://github.com/MrDupin/aima-go)

------
dreamcompiler
Wow. Wish I'd found this a month ago. I just bought yet another paper copy
(the binding of the paper version is not very durable).

------
krylon
This is awesome! I lost my copy or borrowed it to somebody and do not remember
who or when.

Either way, this was one of the most fun programming books I have ever read,
Lisp or no Lisp.

------
runevault
I bought this a long time ago and never took the time to go through it. I
should correct that, maybe this reminder will get me to finally dig in.

------
equalunique
Awesome. I have had this much-recommended book sitting on the shelf for a year
now and this is a helpful reminder that I should start on it.

------
lispm
I don't know why the title of the submission has been changed. It's not only
the code, a PDF of the book is in the repository, too.

~~~
jacquesm
962 pages. It'll be a while I guess.

~~~
vram22
Yes, it seems big. Tried to download the PDF on my mobile earlier, Android
said the file is too big. Same for the text file :) First time I've seen that
message. Checking it out on PC now.

------
cup-of-tea
I distinctly remember learning memoisation from this book. Great memories!

