{"id":13834831,"url":"https://norvig.github.io/paip-lisp/","last_synced_at":"2025-07-10T07:31:01.203Z","repository":{"id":37547755,"uuid":"120367500","full_name":"norvig/paip-lisp","owner":"norvig","description":"Lisp code for the textbook \"Paradigms of Artificial Intelligence Programming\"","archived":false,"fork":false,"pushed_at":"2024-10-15T03:26:54.000Z","size":76497,"stargazers_count":7347,"open_issues_count":35,"forks_count":714,"subscribers_count":235,"default_branch":"main","last_synced_at":"2025-07-04T19:05:54.374Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/norvig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-05T22:02:34.000Z","updated_at":"2025-07-04T17:48:18.000Z","dependencies_parsed_at":"2023-02-09T16:45:57.226Z","dependency_job_id":"fe58bbc5-6a0b-41d8-b760-ebf7e5b78d26","html_url":"https://github.com/norvig/paip-lisp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/norvig/paip-lisp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norvig%2Fpaip-lisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norvig%2Fpaip-lisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norvig%2Fpaip-lisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norvig%2Fpaip-lisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/norvig","download_url":"https://codeload.github.com/norvig/paip-lisp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/norvig%2Fpaip-lisp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264545157,"owners_count":23625403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T14:00:52.792Z","updated_at":"2025-07-10T07:30:56.185Z","avatar_url":"https://github.com/norvig.png","language":"Common Lisp","funding_links":[],"categories":["AI","Offline ##"],"sub_categories":[],"readme":"\n\u003cimg src=\"paip-cover.png\" title=\"Paradigms of Artificial Intelligence Programming\" width=413\u003e\n\nThis is an open-source repository for the book *Paradigms of Artificial\nIntelligence 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](https://github.com/cs-books/influential-cs-books). As seen on [TV](https://norvig.com/paip-tv.html). See also: [errata](https://norvig.com/paip-errata.html), [comments](https://norvig.com/paip-comments.html),  [retrospective](https://norvig.com/Lisp-retro.html).\n\nThe book is available in these formats:\n\n* we're generating ebooks - epub and pdf - from the markdown files, see [Releases](https://github.com/norvig/paip-lisp/releases)\n* [scanned pdfs](https://github.com/norvig/paip-lisp/releases/tag/v1.3)\n  * 4th edition, 1998: higher resolution, better OCR, smaller file thanks to better compression\n  * 6th edition, 2001: newer printing\n* text: [PAIP.txt](https://github.com/norvig/paip-lisp/blob/master/PAIP.txt) (from OCR'ing the scanned pdf, containing many errors)\n* a source epub: [see releases](https://github.com/norvig/paip-lisp/releases/tag/1.1) for a cleaned up version downloaded from Safari (much cleaner than the scanned versions)\n* and `chapter?.md` markdown files:\n\n# Table of Contents\n\n- **Paradigms of Artificial Intelligence Programming**\n  * [Front matter](docs/frontmatter.md)\n  * [Preface](docs/preface.md)\n- **Part I:  Introduction to Common Lisp**\n  * 1  [Introduction to Lisp](docs/chapter1.md)\n  * 2  [A Simple Lisp Program](docs/chapter2.md)\n  * 3 [Overview of Lisp](docs/chapter3.md)\n- **Part II: Early AI Programs**\n  * 4  [GPS:  The General problem Solver](docs/chapter4.md)\n  * 5  [Eliza:  Dialog with a Machine](docs/chapter5.md)\n  * 6  [Building Software Tools](docs/chapter6.md)\n  * 7 [Student:  Solving Algebra Word Problems](docs/chapter7.md)\n  * 8 [Symbolic Mathematics:  A Simplification Program](docs/chapter8.md)\n- **Part III:  Tools and Techniques**\n  * 9  [Efficiency Issues](docs/chapter9.md)\n  * 10  [Low-Level Efficiency Issues](docs/chapter10.md)\n  * 11  [Logic Programming](docs/chapter11.md)\n  * 12  [Compiling Logic programs](docs/chapter12.md)\n  * 13  [Object-Oriented Programming](docs/chapter13.md)\n  * 14  [Knowledge Representation and Reasoning](docs/chapter14.md)\n- **Part IV:  Advanced AI Programs**\n  * 15  [Symbolic Mathematics with Canonical Forms](docs/chapter15.md)\n  * 16  [Expert Systems](docs/chapter16.md)\n  * 17  [Line-Diagram Labeling by Constraint Satisfaction](docs/chapter17.md)\n  * 18  [Search and the Game of Othello](docs/chapter18.md)\n  * 19  [Introduction to Natural Language](docs/chapter19.md)\n  * 20  [Unification Grammars](docs/chapter20.md)\n  * 21  [A Grammar of English](docs/chapter21.md)\n- **Part V:  The Rest of Lisp**\n  * 22  [Scheme:  An Uncommon Lisp](docs/chapter22.md)\n  * 23  [Compiling Lisp](docs/chapter23.md)\n  * 24  [ANSI Common Lisp](docs/chapter24.md)\n  * 25  [Troubleshooting](docs/chapter25.md)\n\n## The Lisp Files\n\nThe [Lisp code files](https://github.com/norvig/paip-lisp/tree/master/lisp) are listed here:\n\n| CH   | Filename                            | Description                                                            |\n|------|-------------------------------------|------------------------------------------------------------------------|\n| -    | [examples.lisp](lisp/examples.lisp) | A list of example inputs taken from the book                           |\n| -    | [tutor.lisp](lisp/tutor.lisp)       | An interpreter for running the examples                                |\n| -    | [auxfns.lisp](lisp/auxfns.lisp)     | Auxiliary functions; load this before anything else                    |\n| 1    | [intro.lisp](lisp/intro.lisp)       | A few simple definitions                                               |\n| 2    | [simple.lisp](lisp/simple.lisp)     | Random sentence generator (two versions)                               |\n| 3    | [overview.lisp](lisp/overview.lisp) | 14 versions of LENGTH and other examples                               |\n| 4    | [gps1.lisp](lisp/gps1.lisp)         | Simple version of General Problem Solver                               |\n| 4    | [gps.lisp](lisp/gps.lisp)           | Final version of General Problem Solver                                |\n| 5    | [eliza1.lisp](lisp/eliza1.lisp)     | Basic version of Eliza program                                         |\n| 5    | [eliza.lisp](lisp/eliza.lisp)       | Eliza with more rules; different reader                                |\n| 6    | [patmatch.lisp](lisp/patmatch.lisp) | Pattern Matching Utility                                               |\n| 6    | [eliza-pm.lisp](lisp/eliza-pm.lisp) | Version of Eliza using utilities                                       |\n| 6    | [search.lisp](lisp/search.lisp)     | Search Utility                                                         |\n| 6    | [gps-srch.lisp](lisp/gps-srch.lisp) | Version of GPS using the search utility                                |\n| 7    | [student.lisp](lisp/student.lisp)   | The Student Program                                                    |\n| 8    | [macsyma.lisp](lisp/macsyma.lisp)   | The Macsyma Program                                                    |\n| 8    | [macsymar.lisp](lisp/macsymar.lisp) | Simplification and integration rules for Macsyma                       |\n| 9-10 | [auxfns.lisp](lisp/auxfns.lisp)     | Auxiliary functions                                                    |\n| 11   | [unify.lisp](lisp/unify.lisp)       | Unification functions                                                  |\n| 11   | [prolog1.lisp](lisp/prolog1.lisp)   | First version of Prolog interpreter                                    |\n| 11   | [prolog.lisp](lisp/prolog.lisp)     | Final version of Prolog interpreter                                    |\n| 12   | [prologc1.lisp](lisp/prologc1.lisp) | First version of Prolog compiler                                       |\n| 12   | [prologc2.lisp](lisp/prologc2.lisp) | Second version of Prolog compiler                                      |\n| 12   | [prologc.lisp](lisp/prologc.lisp)   | Final version of Prolog compiler                                       |\n| 12   | [prologcp.lisp](lisp/prologcp.lisp) | Primitives for Prolog compiler                                         |\n| 13   | [clos.lisp](lisp/clos.lisp)         | Some object-oriented and CLOS code                                     |\n| 14   | [krep1.lisp](lisp/krep1.lisp)       | Knowledge Representation code: first version                           |\n| 14   | [krep2.lisp](lisp/krep2.lisp)       | Knowledge Representation code with conjunctions                        |\n| 14   | [krep.lisp](lisp/krep.lisp)         | Final KR code: worlds and attached functions                           |\n| 15   | [cmacsyma.lisp](lisp/cmacsyma.lisp) | Efficient Macsyma with canonical form                                  |\n| 16   | [mycin.lisp](lisp/mycin.lisp)       | The Emycin expert system shell                                         |\n| 16   | [mycin-r.lisp](lisp/mycin-r.lisp)   | Some rules for a medical application of emycin                         |\n| 17   | [waltz.lisp](lisp/waltz.lisp)       | A Line-Labeling program using the Waltz algorithm                      |\n| 18   | [othello.lisp](lisp/othello.lisp)   | The Othello playing program and some strategies                        |\n| 18   | [othello2.lisp](lisp/othello2.lisp) | Additional strategies for Othello                                      |\n| 18   | [edge-tab.lisp](lisp/edge-tab.lisp) | Edge table for Iago strategy                                           |\n| 19   | [syntax1.lisp](lisp/syntax1.lisp)   | Syntactic Parser                                                       |\n| 19   | [syntax2.lisp](lisp/syntax2.lisp)   | Syntactic Parser with semantics                                        |\n| 19   | [syntax3.lisp](lisp/syntax3.lisp)   | Syntactic Parser with semantics and preferences                        |\n| 20   | [unifgram.lisp](lisp/unifgram.lisp) | Unification Parser                                                     |\n| 21   | [grammar.lisp](lisp/grammar.lisp)   | Comprehensive grammar of English                                       |\n| 21   | [lexicon.lisp](lisp/lexicon.lisp)   | Sample Lexicon of English                                              |\n| 22   | [interp1.lisp](lisp/interp1.lisp)   | Scheme interpreter, including version with macros                      |\n| 22   | [interp2.lisp](lisp/interp2.lisp)   | A tail recursive Scheme interpreter                                    |\n| 22   | [interp3.lisp](lisp/interp3.lisp)   | A Scheme interpreter that handles call/cc                              |\n| 23   | [compile1.lisp](lisp/compile1.lisp) | Simple Scheme compiler                                                 |\n| 23   | [compile2.lisp](lisp/compile2.lisp) | Compiler with tail recursion and primitives                            |\n| 23   | [compile3.lisp](lisp/compile3.lisp) | Compiler with peephole optimizer                                       |\n| 23   | [compopt.lisp](lisp/compopt.lisp)   | Peephole optimizers for compile3.lisp                                  |\n\n# Running the Code\n\nThere is no single \"application\" to run. Rather, there is a collection of source code files,\nduplicating the code in the book. You can read and/or run whatever you like. Lisp is an interactive language,\nand you will need to interact with the code to get benefit from it. Some hints:\n\n* You will need a Common Lisp interpreter/compiler/environment. Here's a [discussion](https://www.reddit.com/r/lisp/comments/752wxe/what_is_the_best_common_lisp_interpreter_out_there/) of the options.\n* You will always need `(load \"auxfns.lisp\")`.\n* You will need `(requires \"`*file*`\")`, for the various\ninstances of *file* that you want to use. (If `requires` does not work properly on\nyour system you may have to alter its definition, in \n`auxfns.lisp`.  \n* The function `do-examples`, which takes as an argument either `:all`\nor a chapter number or a list of chapter numbers, can be used to see examples\nof the use of various functions.  For example, `(do-examples 1)` shows\nthe examples from chapter 1. Access this by doing `(requires \"examples\")`.\n\n# Other resources\n\n* I wrote a [retrospective](http://norvig.com/Lisp-retro.html) on the book in 2002.\n* There is a nice [Python version](https://github.com/dhconnelly/paip-python) of the code, by Daniel Connelly at Georgia Tech, supervised by Ashok Goel.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/norvig.github.io%2Fpaip-lisp%2F","html_url":"https://awesome.ecosyste.ms/projects/norvig.github.io%2Fpaip-lisp%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/norvig.github.io%2Fpaip-lisp%2F/lists"}