What does HackerNews think of paip-lisp?
Lisp code for the textbook "Paradigms of Artificial Intelligence Programming"
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.
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.
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.
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/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).
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
> 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
[0] https://github.com/norvig/paip-lisp
[1] https://emacs.stackexchange.com/questions/5465/how-to-migrat...
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
useful link:
https://github.com/norvig/paip-lisp
https://emacs.stackexchange.com/questions/5465/how-to-migrat...
If you'd like to see how to do that yourself: https://github.com/norvig/paip-lisp
I've helped on the ongoing work of ebook cleanup.
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
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).
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
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/
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.
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]
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.
Here - https://github.com/prolog8/awkprolog - is an interesting example of Prolog written in AWK. Not too long and neither too dense code.
I think there is ongoing effort to update it for better accessibility.
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.
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.
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:
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.
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)
'Paradigms of Artificial Intelligence Programming' by Peter Norvig[0]. The book teaches both LISP and classic AI.
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.
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
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