HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
norvig
paip-lisp
Common Lisp2018–2026
norvig / paip-lisp

paip-lisp

Lisp code for the textbook "Paradigms of Artificial Intelligence Programming"

63Distinct people
102Mentions
6Explicit recommenders
7.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Lisp code for the textbook "Paradigms of Artificial Intelligence Programming"

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

This is the Logic Theorist: https://en.wikipedia.org/wiki/Logic_Theorist I love Simon's anecdote of using his wife and children as the stack as he developed IPS. This…

kjander79 used a recommendation phrase. 6 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year102 dated mentions

Observed mentions: 2018-02-26 21:33:21 UTC to 2026-04-19 12:10:13 UTC.

051015202018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 11 mentions; 3 submissions, 8 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 14 mentions; 3 submissions, 11 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 11 mentions; 1 submissions, 10 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 15 mentions; 0 submissions, 15 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 15 mentions; 2 submissions, 13 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 19 mentions; 1 submissions, 18 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC1138
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC14311
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC11110
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC15015
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC15213
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC707
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC19118
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC808
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC202

From the project README

An excerpt from the repository, fetched Nov 12, 2026.

Read the project’s introduction
This is an open-source repository for the book Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp by Peter Norvig (1992), and the code contained therein. The copyright has reverted to the author, who has shared it here under MIT license. On the list of most influential books for programmers. As seen on TV. See also: errata, comments, retrospective. The book is available in these formats: we're generating ebooks - epub and pdf - from the markdown files, see Releases scanned pdfs 4th edition, 1998: higher resolution, better OCR, smaller file thanks to better compression 6th edition, 2001: newer printing text: PAIP.txt (from OCR'ing the scanned pdf, containing many errors) a source epub: see releases for a cleaned up version downloaded from Safari (much cleaner than the scanned versions) and chapter?.md markdown files: Table of Contents Paradigms of Artificial Intelligence Programming Front matter Preface Part I: Introduction to Common Lisp 1 Introduction to Lisp 2 A Simple Lisp Program 3 Overview of Lisp Part II: Early AI Programs 4 GPS: The General problem Solver 5 Eliza: Dialog with a Machine 6 Building Software Tools 7 Student: Solving Algebra Word Problems 8 Symbolic Mathematics: A Simplification Program Part III: Tools and Techniques 9 Efficiency Issues 10 Low-Level Efficiency Issues 11 Logic Programming 12 Compiling Logic programs 13 Object-Oriented Programming 14 Knowledge Representation and Reasoning Part IV: Advanced AI Programs 15 Symbolic Mathematics with Canonical Forms 16 Expert Systems 17 Line-Diagram Labeling by Constraint Satisfaction 18 Search and the Game of Othello 19 Introduction to Natural Language 20 Unification Grammars 21 A Grammar of English Part V: The Rest of Lisp 22 Scheme: An Uncommon Lisp 23 Compiling Lisp 24 ANSI Common Lisp 25 Troubleshooting The Lisp Files The Lisp code files are listed here: CH Filename Description - examples.lisp A list of example inputs taken from the book - tutor.lisp An interpreter for running the examples - auxfns.lisp Auxiliary functions; load this before anything else 1 intro.lisp A few simple definitions 2 simple.lisp Random sentence generator (two versions) 3 overview.lisp 14 versions of LENGTH and other examples 4 gps1.lisp Simple version of General Problem Solver 4 gps.lisp Final version of General Problem Solver 5 eliza1.lisp Basic version of Eliza program 5 eliza.lisp Eliza with more rules; different reader 6 patmatch.lisp Pattern Matching Utility 6 eliza-pm.lisp Version of Eliza using utilities 6 search.lisp Search Utility 6 gps-srch.lisp Version of GPS using the search utility 7 student.lisp The Student Program 8 macsyma.lisp The Macsyma Program 8 macsymar.lisp Simplification and integration rules for Macsyma 9-10 auxfns.lisp Auxiliary functions 11 unify.lisp Unification functions 11 prolog1.lisp First version of Prolog interpreter 11 prolog.lisp Final version of Prolog interpreter 12 prologc1.lisp First version of Prolog compiler 12 prologc2.lisp Second version of Prolog compiler 12 prologc.lisp Final version of Prolog compiler 12 prologcp.lisp Primitives for Prolog compiler 13 clos.lisp Some object-oriented and CLOS code 14 krep1.lisp Knowledge Representation code: first version 14 krep2.lisp Knowledge Representation code with conjunctions 14 krep.lisp Final KR code: worlds and attached functions 15 cmacsyma.lisp Efficient Macsyma with canonical form 16 mycin.lisp The Emycin expert system shell 16 mycin-r.lisp Some rules for a medical application of emycin 17 waltz.lisp A Line-Labeling program using the Waltz algorithm 18 othello.lisp The Othello playing program and some strategies 18 othello2.lisp Additional strategies for Othello 18 edge-tab.lisp Edge table for Iago strategy 19 syntax1.lisp Syntactic Parser 19 syntax2.lisp Syntactic Parser with semantics 19 syntax3.lisp Syntactic Parser with semantics and preferences 20 unifgram.lisp Unification Parser 21 grammar.lisp Comprehensive grammar of English 21 lexicon.lisp Sample Lexicon of English 22 interp1.lisp Scheme interpreter, including version with macros 22 interp2.lisp A tail recursive Scheme interpreter 22 interp3.lisp A Scheme interpreter that handles call/cc 23 compile1.lisp Simple Scheme compiler 23 compile2.lisp Compiler with tail recursion and primitives 23 compile3.lisp Compiler with peephole optimizer 23 compopt.lisp Peephole optimizers for compile3.lisp Running the Code There is no single "application" to run. Rather, there is a collection of source code files, duplicating the code in the book. You can read and/or run whatever you like. Lisp is an interactive language, and you will need to interact with the code to get benefit from it. Some hints: You will need a Common Lisp interpreter/compiler/environment. Here's a discussion of the options. You will always need (load "auxfns.lisp"). You will need (requires "file"), for the various instances of file that you want to use. (If requires does not work properly on your system you may have to alter its definition, in auxfns.lisp. The function do-examples, which takes as an argument either :all or a chapter number or a list of chapter numbers, can be used to see examples of the use of various functions. For example, (do-examples 1) shows the examples from chapter 1. Access this by doing (requires "examples"). Other resources I wrote a retrospective on the book in 2002. There is a nice Python version of the code, by Daniel Connelly at Georgia Tech, supervised by Ashok Goel.
Read the full README on GitHub

What Hacker News says

102 sources
Yep, and after that I'd jump into PAIP, Paradigms of AI Programming. Code: https://github.com/norvig/paip-lisp The EPUB looks broken in my machine, try the PDF: https://commons.wikimedia.org/wiki/File:Peter_Norvig._Paradi... Altough Scheme and CL are different paths. CL's loop it's really, really complex and Scheme it's pretty much straightforward to understand. Any advanced CL user will have to implement Scheme's syntax (and an interpreter) as an exercise for PAIP. CL in CL... well, CL is too huge, T3X tried with Kilo Lisp 23 http://t3x.org/klisp/22/index.html and I doubt if anyone can even complete anything but the few starting chapters from Intro to Common Lisp with it.
In The seven programming ur-languages (2022)
This is a nice and unexpected release, thanks for writing it. Getting a RPG endorsement is great. I just finished reading his foreword and skimming the table of contents and bibliography from the preview. I'd have liked to see a sample of a middle chapter to really see how technical and deep it gets (e.g. Land of Lisp gives its chapter 8 as a sample which I think is very representative for that book). But I plan to get this book regardless -- just not right now. The back blurb hints that expert systems might be mentioned, but how much? No one ever seems to go much into their implementation or usage.[0] It also mentions writing some JS, which I guess is part of chapter 5, I wonder if that was a publisher request. (My favorite take on that subject in recent years is https://github.com/jart/sectorlisp) Would it be fair to say this is mainly
Read the rest
a history told through the lens of AI and PL research? Amusingly I think part of me is already setting myself up for some disappointment -- it seems too short with too few references! But it's good to have a Lisp history book like this looks to be and I'm sure I'll learn things from it, and the promise of more RPG writings inside is enticing. Besides, any complete telling would take multiple books. (There's so much of historical interest locked up in proprietary applications and companies with their own histories, and so many papers published, there's also so much that can be dug through in the standardization mailing list (and other lists, like emacs) archives[1], the SAIL archives[2], the Xerox PARC archives[3], the CMU archives[4], and the many undigitized things sitting in boxes at the computer history museum...[5]) [0] Norvig's PAIP gives a small taste, one of the files: https://github.com/norvig/paip-lisp/blob/main/lisp/mycin-r.l... And a book about a particular system, MYCIN: https://www.shortliffe.net/Buchanan-Shortliffe-1984/MYCIN%20... And a short video: https://youtube.com/watch?v=a65uwr_O7mM [1] http://ml.cddddr.org/ and http://cl-su-ai.lisp.se/ [2] https://www.saildart.org/ [3] The url I had before is down... I made a local copy but https://archive.org/details/2014.01.ftp.parc.xerox.com might be the same content [4] https://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/... [5] Even in the earliest Lisp reports like https://www.researchgate.net/publication/42766480_Artificial... there are interesting things mentioned like a two-move checkmate program or "Other projects on which work continues include the Advice Taker, visual pattern recognition, and an artificial hand." Multiple times I've tried to track down those sorts of things mentioned in really old papers only to hit dead-ends on so many of them. Sometimes things were embellished, or were abandoned, or were just lost to time, and sometimes there's an undigitized box at the museum that might contain printouts etc. (There might be MYCIN source code, even.)
In Show HN: I wrote a technical history book on Lisp
I think Pandoc and Calibre could work for you. I've worked on PAIP, Paradigms of Artificial Intelligence Programming, and I might be able to help you a bit. It's around 1k pages long. I used Pandoc to generate an epub file, and then Calibre to turn that into a PDF file. I just tried using Pandoc to generate the PDF file directly, and it/LaTeX choked on some Unicode characters. For internal ebook links, there's a Lua script. You'll have to keep anchors unique across the book for this: * good: "chapter1#section1_1" and "chapter2#section2_1" * bad: a "chapter1#section1" and a "chapter2#section1" WIP: https://github.com/norvig/paip-lisp/pull/195 For line wrapping of code, there's CSS. I first used it over on "Writing an Operating System in 1,000 Lines"; here's the PR: https://github.com/nuta/operating-system-in-1000-lines/pull/...
In Ask HN: Where are the good Markdown to PDF tools (that meet these requirements)?
I made a high-quality scan of PAIP (Paradigms of Artificial Intelligence Programming), and worked on OCR'ing and incorporating that into an admittedly imperfect git repo of Markdown files. I used Scantailor to deskew and do other adjustments before applying Tesseract, via OCRmyPDF. I wrote notes for some of my process over at https://github.com/norvig/paip-lisp/releases/tag/v1.2 . I'd also tried ocrit, which uses Apple's Vision framework for OCR, with some success - https://github.com/insidegui/ocrit It's an ongoing, iterative process. I'll watch this thread with interest. Some recent threads that might be helpful: * https://news.ycombinator.com/item?id=42443022 - Show HN: Adventures in OCR * https://news.ycombinator.com/item?id=43045801 - Benchmarking vision-language models on OCR in dynamic video environments - driscoll42 posted some st
Read the rest
ats from research * https://news.ycombinator.com/item?id=43043671 - OCR4all (Meaning, I have these browser tabs open, I haven't fully digested them yet)
In Ask HN: What is the best method for turning a scanned book as a PDF into text?
In case anyone is wondering, "when would I EVER use this (in hand-written code)?", it's a trick that makes DSL (domain specific language) and small language implementation much easier. A great reference for this is Peter Norvig's Paradigms of Artificial Intelligence Programming, when he implements a subset of Prolog and bolsters the functionality using CPS[1]. The second, although more obscure, is that you can use it in languages that do not have "non-local exits" to terminate a deeply nested computation early or return to an earlier point in the call stack. For example, Clojure does not have nonlocal exits, as only the final form of the function is returned. However, using CPS, you can terminate the expression early and return to the original caller without executing the rest of the function. You probably only want to use this in specia
Read the rest
lized cases though or it may upset your team, they are tricky to debug. Lastly and probably most controversially, you can make an extensible "if" statement using CPS if you are in a dynamic language and you have no other tools to do so. Admittedly I do sometimes use this in ClojureScript. This allows you to write "append only" code without continually growing the "cond". Again, most teams don't like this, so it depends on the circumstances, but might be nice to have in your back pocket if you need it. [1]: https://github.com/norvig/paip-lisp/blob/main/docs/chapter12...
In Into CPS, Never to Return
pronoiac·Dec 17, 2024Recommendation phrase
Oh wow! I've worked on turning PAIP (Paradigms of Artificial Intelligence Programming) from a book into a bunch of Markdown files, but that's "only" about a thousand pages long, compared to the roughly 27000 pages long of all those volumes. I have advice, possibly helpful, possibly not. Getting higher quality scans could save you some headaches. Check the Internet Archive. Or, get library copies, and the right camera setup. Scantailor might help; it lets you semi-automate a chunk of things, with interactive adjustments. I don't know how its deskewing would compare to ImageMagick. The signature marks might be filtered out here. I wrote out some of my process for handling scans here - https://github.com/norvig/paip-lisp/releases/tag/v1.2 . I maybe should blog about it. If you get to the point of collaborative proofreading, I highly recommen
Read the rest
d Semantic Linefeeds - each sentence gets its own line. https://rhodesmill.org/brandon/2012/one-sentence-per-line/ I got there by: * giving each paragraph its own line * then, linefeed at punctuation, maybe with quotation marks and parentheses? It's been a while
In Show HN: Adventures in OCR
Hot take: SICP and SD4F "considered harmful (without counterpoint)"*. Why? The modus operandi of problem solving in these books is object oriented programming masquerading as functional programming, and it is presented as a _neutral_ beginner book. It is _not neutral_. This is a very opinionated approach to programming. To be fair, I do not believe the authors intended for this style of programming to be taken as gospel, but it is often presented _without counterpoint_. The most powerful technique introduced -- implementing complex behavior via extensible polymorphic generics -- is virtually unmaintainable without a compiler-supported static type checker. You would know that if you ever tried to implement the code yourself in a dynamic language of your choice. The ramifications of these choices can be felt far and wide and are largely
Read the rest
unquestioned. Ironically, they make code hard to understand, hard to extend, and hard to maintain. I need to reiterate, I do not believe the intention of the authors was to suggest these ideas should be used beyond a pedagogical setting, but they often are. As a specific critique to SD4F, which states as a goal making code more resilient by emulating biology, I would point to Leslie Lamport's talk on logic vs biology[1]. I would add that I think SICP would be fine if it were taught in tandem with Paradigms of Artificial Intelligence Programming by Peter Norvig[2]. PAIP offers a completely different approach to solving problems, also using lisp. This approach is much closer to constructing a language to model a problem and then solving the problem symbolically using the language created. Areas that use OO techniques, such as the chapter in CLOS, are clearly marked as such. In other words, I say "SICP considered harmful" because thrusting it upon an eager newcomer as a trusted neutral guide to beginner coding (without offering any counterpoint) could set them back by a decade, filling their head with "functional object oriented programming" concepts that don't translate well to industry or CS. [*]: I say this as someone who has thoroughly studied both books, implemented the code, taken Dave Beazely courses to have the information spoon fed to me (dabeaz is awesome btw, take all his stuff) and used the techniques in production code bases. [1]: https://lamport.azurewebsites.net/pubs/future-of-computing.p... [2]: https://github.com/norvig/paip-lisp
In SICP: The only computer science book worth reading twice? (2010)
A historical tidbit which I loved in Paradigms of Artificial Intelligence Programming (available in PDF and EPUB here - https://github.com/norvig/paip-lisp): > The name lambda comes from the mathematician Alonzo Church's notation for functions (Church 1941). Lisp usually prefers expressive names over terse Greek letters, but lambda is an exception. A better name would be make-function. Lambda derives from the notation in Russell and Whitehead's Principia Mathematica, which used a caret over bound variables: x̂(x + x). Church wanted a one-dimensional string, so he moved the caret in front: ^x(x + x). The caret looked funny with nothing below it, so Church switched to the closest thing, an uppercase lambda, Λx(x + x) . The Λ was easily confused with other symbols, so eventually the lowercase lambda was substituted: λx(x + x). John McCarthy
Read the rest
was a student of Church's at Princeton, so when McCarthy invented Lisp in 1958, he adopted the lambda notation. There were no Greek letters on the keypunches of that era, so McCarthy used (lambda (x) (+ x x)), and it has survived to this day. So, yes, on the topic of this post - Church pops up in loads of Lisp retrospectives. Maybe he's "forgotten" by people with very little engagement in the history of computing.
In Alonzo Church: Architect of computer intelligence

Showing the 15 most recent of 102 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.