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 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 6:28:55 AM 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

15 sources
reikonomusha·Nov 25, 2022Recommendation phrase
For Common Lisp, there are several free books available: - Practical Common Lisp (aimed at people who know how to program in a more mainstream language already) [1] - Paradigms in Artificial Intelligence Programming (my personal favorite) [2] - Common Lisp: A Gentle Introduction to Symbolic Computation (aimed at absolute beginners of programming) [3] I highly recommend the r/lisp Reddit community. Reddit as a platform has its issues, but the Common Lisp community there is very responsive and very helpful. Lastly, you might be interested in checking out Kandria [4], a game written entirely in Common Lisp, to be released imminently on Steam. [1] https://gigamonkeys.com/book/ [2] https://github.com/norvig/paip-lisp [3] https://www.cs.cmu.edu/~dst/LispBook/ [4] https://store.steampowered.com/app/1261430/Kandria/
In A few examples of Lisp code typography (2013)
Lisp macros are nice, but as Gumby said above [0] a common approach is to use Lisp's quoting abilities to construct a data structure that represents the problem at hand (in its own terms) and then create functions to parse / manipulate that data structure. A classic example comes from Peter Norvig's "Principles of Artificial Intelligence" wherein he defines a subset of English grammar as a data structure [1]: '((sentence -> (noun-phrase verb-phrase)) (noun-phrase -> (Article Noun)) (verb-phrase -> (Verb noun-phrase)) (Article -> the a) (Noun -> man ball woman table) (Verb -> hit took saw liked))) He then goes on to define a function "generate" that uses the above to create simplistic English sentences. Additional rules can be added by a non-programmar so long as they understand how their domain logic has been mapped
Read the rest
In Little languages are the future of programming
SICP contains a chapter on non-deterministic programming that’s similar to how Prolog executes: https://mitp-content-server.mit.edu/books/content/sectbyfn/b... There’s also a chapter on logic programming but it doesn’t quite work the same way as Prolog: https://mitp-content-server.mit.edu/books/content/sectbyfn/b... Peter Norvig has a couple of chapters (11,12) on how to implement Prolog in his book PAIP. He also has a chapter (17) on constraint satisfaction but IIRC it’s not integrated into his Prolog system: https://github.com/norvig/paip-lisp Many real Prolog implementations are based on the WAM. For an excellent introduction to the WAM look at: http://wambook.sourceforge.net/ I don’t have books or papers on implementing constraints and how to integrate them with Prolog. But here are two great classes on Coursera that explain how const
Read the rest
raints and constraint propagation work. You can audit them for free: Discrete Optimization by Hentenryck https://www.coursera.org/learn/discrete-optimization Solving Algorithms for Discrete Optimization by Lee and Stuckey https://www.coursera.org/learn/solving-algorithms-discrete-o... I believe constraints are typically integrated into Prolog through attributed variables: https://www.metalevel.at/prolog/attributedvariables But I don’t really know how that works. Markus Triska has a few papers on constraint solvers for SWI Prolog on his webpage. He can probably give you more and better pointers: https://www.metalevel.at/
In Ask HN: Best resources on implementing constraint logic programming?
https://github.com/norvig/paip-lisp - Peter Norvig's Paradigm's of AI Programming https://github.com/norvig/paip-lisp/search?l=Markdown&q=defm... - all references to defmacro in the markdown files Chapter 3 shows a simple macro, just adding a while loop to the language. Chapter 9 shows some more complex ones, including a with- macro and a grammar compiler macro. Chapters 11 and 12 show the development of a Prolog implementation in CL using defmacro to aid in compilation again in Chapter 11. Chapter 12 shows adding an OO system to the language. Technically not needed with CLOS, but a good demonstration of what can be done with macros. There are other examples (why I included that search link). Macros let you change the language in ways large and small. Many uses could probably be replaced with functions, though you'd end up having to throw
Read the rest
a bunch of quotes about or closures in order to delay processing things. You'd also be delaying that to runtime, which incurs its own penalties compared to macro expansion and compile time (if a compiled CL).
In Common Lisp vs Racket
Land of Lisp is fun, and the video is a must![0]; I also really like Norvig's PAIP (Paradigms of Artificial Intelligence Programming, available for free now on GitHub[1]). PAIP shows ways of programming in Lisp that really are unlike what I've seen in most other languages. Lately I have been working the Exercism exercises and there are over 80 Common Lisp problems, with more problems being added over time (my hope is to finish what's there and then help by adding some more). [0] https://www.youtube.com/watch?v=HM1Zb3xmvMc [1] https://github.com/norvig/paip-lisp
In A Road to Common Lisp (2018)
It's not easy to get the point across just by reading about it. Id honestly say you should just learn some lisp and implement something cool. > I don't see why this would be any different than defining a function like I normally do. Because with functions you don't define any new syntax or implement a DSL; you don't have access to the compiler during read, compilation, and run time. This allows you to easily extend the language: do you miss list comprehensions from Python? Add it yourself with a macro. Want to generate boilerplate code? Macro. Prolog compiler? Yes. Basically anything in this book: https://github.com/norvig/paip-lisp > But why is this more productive than simply defining a "exponent()" function or something similar? It's not just about defining a new operator, you can basically implement a DSL with C-like syntax if you wan
Read the rest
In Tutorial Series to learn Common Lisp quickly
i have a different understanding. the book teaches a design process that starts of by understanding the problem you are trying to solve, then working out the specification of your program, followed by implementation, followed by introducing tests, followed by code analysis and review in order make correct abstractions to build a general modular code-base that can be used across different applications. i am not sure about your experience, but as far as i know this is a very up-to-date approach in software engineering. for reference here is the chapter on GPS [0], which by the way is the first non-introductory chapter! i think you should work more through the book before holding strong opinions about it [0] https://github.com/norvig/paip-lisp/blob/main/docs/chapter4....
In A Retrospective on PAIP (2002)
PAIP is still on my list to work through. Last time I tried I got as far as the first substantive program (https://github.com/norvig/paip-lisp/blob/main/lisp/gps.lisp), was generally confused by the code, and was then not surprised when the following sections pointed out all the faults (i.e. bugs) with the initial approach and suggested various improvements. I've come to trust my own "how can this possibly work?" confusion as a strong signal that a design is probably buggy or fragile, so it was nice to see it confirmed here. Which is not to say that what this book teaches is not useful, but I wouldn't go to it looking for best practice and robust software engineering techniques. Much of what I saw in this book wouldn't pass code review in many situations ("too fragile" or "too clever"). Most of what he's talking about are techniques that
Read the rest
"allow a programmer to delay making decisions". This is a different kind of programming than very the very concrete kind of programming that can dominate day to day professional work. I suspect that these kinds of "delayed decisions" are best applied sparingly, but applied correctly they can be powerful. To get a flavor of the "Norvig approach" to things, his Advent of Code solutions in IPython notebooks are fun: https://github.com/norvig/pytudes
In A Retrospective on PAIP (2002)
PAIP is absolutely great in terms of lessons for software engineering. i do not think you need to know lisp before hand in order to digest it. what's more you can now read it in nice markdown format [0]. however an even better solution, if you want to work through the book, is to convert markdown files to org documents [1] and enjoy the book interactively via org-babel [2]. for those unfamiliar, this is like having a book released as a jupyter notebook, except better. in any event if you are interested don't be afraid of lisp, it is a super-easy syntax to learn [0] https://github.com/norvig/paip-lisp [1] https://emacs.stackexchange.com/questions/5465/how-to-migrat... [2] https://orgmode.org/worg/org-contrib/babel/intro.html
In A Retrospective on PAIP (2002)

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.