What does HackerNews think of paip-lisp?

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

Language: Common Lisp

Emacs is so much more than a text editor! But I need to stay on topic...

I believe your assessment of LISP (and therefore of MacArthy)'s impact on AI to be unfair. Just a few days ago https://github.com/norvig/paip-lisp was discussed on this site, for example.

IMHO it's because lisp shines to manipulate symbols whereas the current AI trend is crunching matrices.

When AI was about building grammars, trees, developing expert systems builds rules etc. symbol manipulation was king. Look at PAIP for some examples: https://github.com/norvig/paip-lisp

This paradigm has changed.

For me it was the first time I learnt functional programming in Lisp using Peter Norvig's book called Paradigms of Artificial Intelligence Programming[0].

[0]https://github.com/norvig/paip-lisp

Reading Peter Norvig's PAIP (https://github.com/norvig/paip-lisp) in 1998 totally blew my mind. It completely changed how I think about programming in every other language I use(d). I love it still, and always will. And yes, my experience is the same as yours: learning lisp made me a better programmer in every other language I use (especially -- but not only -- Python).

The simplicity and symmetry of the syntax is a big part of that love for me. Being able to manipulate lisp code as lisp data, using the full power of the language to do so, is just brilliant.

Janet looks lovely! Looking forward to the book.

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 constraints 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/

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 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).

Paradigms of Artificial Intelligence Programming by Peter Norvig

https://github.com/norvig/paip-lisp

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

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 want to: https://github.com/y2q-actionman/with-c-syntax

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

i think that orgmode notebook programing generally beats anything else out of the water, including jupyter. i actually dont uderstand why it hasnt gotten bigger attention in the communities thatvuse jupyter

as for cl, if you enjoy learning it in this way you can convert norvig's paip book from md to org format using pandoc

https://github.com/norvig/paip-lisp

i think PAIP is an absolute gem! not just for learning lisp, but for software engineering in general. not only that but you can read it online in .md format with proper syntax highlighting, which provides for a much better experience. and in fact not only even that (!!), but if you use org-mode you can convert .md files to .org files flawlessly via pandoc and enjoy the whole experience interactively (like jupyter notebook, but only on a whole different leve)

useful link:

https://github.com/norvig/paip-lisp

https://orgmode.org/

https://emacs.stackexchange.com/questions/5465/how-to-migrat...

Norvig's PAIP is what won me over from Scheme to Common Lisp. https://github.com/norvig/paip-lisp
Yes, and commercial Lisp implementations often include a reasonably performant Prolog.

If you'd like to see how to do that yourself: https://github.com/norvig/paip-lisp

Norvig's PAIP is available to read online: https://github.com/norvig/paip-lisp

I've helped on the ongoing work of ebook cleanup.

for one of the possible starters, I would go for the MIT Licensed "Paradigms of Artificial Intelligence Programming" by Peter Norvig. https://github.com/norvig/paip-lisp

a) you get the extra benefit of playing with Lisp b) it gets universal praise c) as you guessed, it's free in the freedom sense

There are other resources specific to machine learning, but the above, from personal experience, actually was fun in the proper sense: expanding my mind, knowledge, and providing a well thought-out learning experience

I'd recommend taking a look at his book Paradigms of AI Programming [0]. It really shows his thought process in developing solutions to problems. The only other way is practice, and in particular practice with languages that offer functional features. Notice his use of lambdas, assignment of existing functions/constructors to more accurate names (Passport instead of dict, day 4), and higher order functions (quantify).

Those are things that really help in algorithmic code by increasing accuracy of the names of things to the application (almost creating a domain specific language).

[0] https://github.com/norvig/paip-lisp

Haven't seen it mentioned, Paradigms of AI Programming by Peter Norvig is another good introduction to Common Lisp. It focuses on classic AI algorithms which showcase the strengths of the language well. It's available online here https://github.com/norvig/paip-lisp
Well, I have a cynical take about the unique appeal of Common Lisp, but even cynicism aside Common Lisp is not going to lose to Racket in the "interesting companies" department, I think. Google Flights is still powered by Common Lisp. Clasp is somewhat interesting (and there is a Google Tech Talk about it, too). And instead of learning "How to Design Programs" from people with unclear experience in designing interesting programs, you can read a book full of small interesting programs written by someone with pretty clear track record of doing interesting things (https://github.com/norvig/paip-lisp).
MAL - Make a Lisp [0]. This one has been discussed on HN before - its where I found it. I completed it last year (from Jan to May 2019) and ended up with Lisp-a-like interpreter written in C# that is sophisticated enough to self-host (i.e. it can interpret and run itself). I picked it up again when the lockdown started and I am now using it to re-implement some of the classic AI systems described in Paradigms of AI Programming [1]. I almost have Eliza (the first chatbot, from 1966!) running, which has necessitated some thinking because MAL is closer to Clojure than the Common Lisp used in PAIP. I'm also implementing what is in effect a standard library of useful MAL functions.

What I got from MAL was much better knowledge of C#, better insights into the power of lisp-like languages, some intense satisfaction when I managed some of the more complex stages, etc. MAL is progressive, supported by 100s of tests, and an amazing array of reference implementations in a huge number of different programming languages.

[Edit] My side-project before MAL involved downloading the Unity game engine and using it to explore the different aspects of game development. I discovered that I really enjoyed asset creation and in particular lighting and shader design, and (long story short - totally bizarre trajectory) ended up creating a tutorial for the Octane render engine that has had actual sales! If I was going to look at games again I'd probably start with a simpler engine such as Godot [2]

[0] https://github.com/kanaka/mal/blob/master/process/guide.md

[1] https://github.com/norvig/paip-lisp

[2] https://godotengine.org/

Not OP, but Lisp isn’t really a functional language — it’s a usual language that also has some functional ideas inside. Mutation is common, don’t think Lisp will be a language like Haskell.

For resources, I would recommend Practical Common Lisp[0] and PAIP[1].

For some modern development practices, the Common Lisp Cookbook[2] is great.

[0]: http://www.gigamonkeys.com/book/

[1]: https://github.com/norvig/paip-lisp

[2]: http://lispcookbook.github.io/cl-cookbook/

For those not in the know, PAIP is Paradigms of Artificial Intelligence Programming, with a fantastic repo here: https://github.com/norvig/paip-lisp
I completely agree. And there are definitely some programmers whose code and prose are both eloquent and beautiful:

https://norvig.com/sudoku.html

This is my all time favorite programming book, both for the prose and the code within it:

https://github.com/norvig/paip-lisp

Interestingly, I find that the set of Lisp programmers also contains many of the best writers about programming: Norvig, Graham, Stallman, McCarthy, Steele, Abelson, Sussman, etc.

Not saying there weren't false starts, but your example of eliminate() is actually a fairly common idiom[0] where, when a function is testing things for "truthiness" or "falsiness", it will return the truthy or falsey value rather than actual True or False. It lets code be more brief because you can do e.g. a check for null and perform assignment of either the value or a default in a single statement, so for example something like this:

  if( maybeNullValue ) {
    myValue = maybeNullValue;
  } else {
    myValue = defaultValue;
  }
can instead be expressed as this:

  myValue = maybeNullValue || defaultValue;
I'm personally a little bit torn about it. On the one hand, now that I'm familiar with it I love how much more concise code can be. On the other, it can have a fairly negative impact on code maintainability: if someone comes along who isn't familiar with that idiom, they might have a bad time trying to figure out what's going on (or worse, they might take offense that all these predicates aren't returning True or False values and rewrite the whole mess--or you could end up with a mix of the two, where some functions follow the idiomatic convention and others return actual boolean values which is arguably the worst)

Also I'm not trying to say that there's not some YAGNI going on here--just that I suspect he did it that way somewhat reflexively, and that in that particular case we probably cannot infer he had originally intended to do something else with those results and then changed his mind later.

[0] at least in the Lisp world, which Norvig has extensive experience with[1]

[1] https://github.com/norvig/paip-lisp

On Lisp is an advanced text about Lisp macros, not recommended as an introduction (but highly recommended if you've written Common Lisp).

SICP is great but not really about Lisp.

I recommend Norvig's PAIP [1] or Graham's ANSI Common Lisp [2].

Another book that's often recommended is Practical Common Lisp but I think it's dated and hasn't aged well. It's also nowhere near as mind expanding as PAIP/Graham's books.

[1] https://github.com/norvig/paip-lisp

[2] PDFs can be found on Google

Clojure is not recommended as it is very different to Lisp.

Lisp code needs to be entirely rewritten before it will run on Clojure. That is not true for Common Lisp, Emacs Lisp and even Scheme.

Norvig constructs a version of Prolog in his book - https://github.com/norvig/paip-lisp , see ch.11

Here - https://github.com/prolog8/awkprolog - is an interesting example of Prolog written in AWK. Not too long and neither too dense code.

The first book, commonly referred to by its acronym PAIP, is available online for free from the author: https://github.com/norvig/paip-lisp

I think there is ongoing effort to update it for better accessibility.

To me, SICP is not really a book about Lisp. Scheme makes the underlying concepts easier to explain. Pedagogical power was one of the motivations for developing Scheme.

The Lisp that's more like Erlang(Elixir). The one that was developed for commercial applications programming is Common Lisp. For me, the book that shows the power of Lisp for applications programming is Norvig's Paradigms of Artificial Intelligence: Case Studies in Common Lisp https://github.com/norvig/paip-lisp

Common Lisp is the result of consensus among industry stakeholders. There is meaningful consistency but no commitment to purity or theory or dogma. More about what people are (were) doing than what "people should do".

YMMV.

Also worth mentioning is Peter Norvig's and Kent Pitman's style guide. It's got a bunch of examples but I've found the presentation helpful when thinking about style in general for other languages, too: https://www.cs.umd.edu/~nau/cmsc421/norvig-lisp-style.pdf

The code in Norvig's book "Paradigms of Artificial Intelligence Programming" is enjoyable to read as well. As a pdf the book itself is freely available: https://github.com/norvig/paip-lisp

And then of course there's the classic Costanza guide at http://www.p-cos.net/lisp/guide.html (not so much about style per se) that contains an important remark, "There cannot be "the one definitive guide" to Lisp. What I present here is what I would have liked to have seen in the first place. Other people probably prefer a different approach."

A quick glance at the broader open source ecosystem will show anyone that most projects don't follow this particular style guide, or this guide is silent on certain things that are probably considered good form enough to put in a company guide, like using uninterned symbols for packages, or using qlot for version pinning your dependencies and having reproducible builds in your CI system, or using UIOP for anything to do with file paths, or... One needs to get comfortable loading a system and then using the usual cross-referencing features of an editor (emacs, vim, atom (https://atom.io/packages/slima), really anything that can talk to a swank server...) since reading code will be the surest way to understand it, especially when it might not be laid out as you expect.

Implementing some kind of Prolog (and also other logic formalism) was common in the AI boom. Some were primitive (for example only using Lisp-like syntax), some were quite extensive (then also providing Edinburgh-Prolog syntax). Most AI tools included some reasoning facility, often in the form of some Prolog. The two commercial Common Lisps (Allegro CL and LispWorks) still offer Prolog implementations.

One of the more extensive treatments of implementing Prolog-like features can be found in "Paradigms of Artificial Intelligence Programming" (PAIP) by Peter Norvig.

Book and code available here:

https://github.com/norvig/paip-lisp

While SICP is certainly a great book, more direct to the topic would be a different classic:

Norvig's Paradigms of AI Programming is purely about creating logic & unification systems in Lisp, and the foundation of many codebases still in use today.

https://github.com/norvig/paip-lisp

I have been working through the examples and exercises in Paradigms of Artificial Intelligence Programming by Peter Norvig, the full text is available online, all code discussed in the book is LISP https://github.com/norvig/paip-lisp
Both SICP and HTDP are very good books. SICP has little more 'attitude' in it, but I think its neutral feature. If you want to learn programming as something between algorithms and programming languages, I suggest these four 'Lisp' books:

1. SICP (Structure and Interpretation of Computer Programs)

2. HTDP (How to Design Programs) https://htdp.org

3. LiSP (Lisp in Small Pieces),

4. PAIP (Paradigms of Artificial Intelligence Programming) https://github.com/norvig/paip-lisp

SICP and HTDP are different but serve the same purpose. LiSP is about interpretation, semantics, and compilation. PAIP by Peter Norvig can seen as elementary programming book that uses classical AI as a subject. You learn both.

I don't know what to think about this, I haven't read it: SICM (Structure and Interpretation of Classical Mechanics)

just found he has a github with the book ( in multiple formats)

https://github.com/norvig/paip-lisp

Mandatory plugin for learning lisp.

'Paradigms of Artificial Intelligence Programming' by Peter Norvig[0]. The book teaches both LISP and classic AI.

[0] https://github.com/norvig/paip-lisp

Thanks for this guide, I'll keep referring to it often.

My current road to Common Lisp is working through Peter Norvig's book Paradigms of Artificial Intelligence Programming [0]. It's not a direct route to the kind of programming most people do nowadays, but I hope to at least get a taste of what it was to be a researcher in classical AI.

[0] https://github.com/norvig/paip-lisp

wow, Hy Lang is sweeet !!! Will check it out, thanks ;)

Considering your question, I'm not a data scientist but this book seems to come up often when search for 'lisp ai' on google. It's pretty old, but maybe it's a good place to start: https://github.com/norvig/paip-lisp

Use Practical Common Lisp [0] as the book to start learning Lisp, Common Lisp is the more production version lisp.

Download LispWorks Personal Edition [1], if you want to start working with an IDE setup. Use it when working through PCL. LW also has GUI library, mobile runtimes and other libraries available from QuickLisp [2], CL's package manager to install various libraries.

After working through PCL, you will have a good CL foundation. You can expand your macro (pun unintended) knowledge by working through [3].

Other good resources: PAIP and Land of Lisp. Note about PAIP is more a specific application of CL to solve classical AI Problems, despite that it is still counted as among the best programming books out there. Hope this helps and `Welcome to the Dark Side`.

PS: Except `Land of Lisp` cited in the resources, everything is free.

[0] http://www.gigamonkeys.com/book/

[1] http://www.lispworks.com/products/lispworks.html#personal

[2] https://www.quicklisp.org/beta/

[3] https://letoverlambda.com, http://www.paulgraham.com/onlisptext.html

[4] http://landoflisp.com, https://github.com/norvig/paip-lisp