
The art of Prolog
advanced programming techniques
by Leon Sterling, Ehud Yehuda Shapiro · first published 1986
114mentions
36recommended by
65HN commenters
2009–2026first – last mentioned
55% recommend45% neutral
Why HN recommends it
Theory-oriented, understandable introduction to Prolog that teaches how to approach problems and think in the language, with exemplary code; suits learners who want depth and the step after a first intro.
Summarised by Claude from recommending comments
This second edition contains revised chapters taking into account recent research advances. More advanced exercises have been included, and "Part II The Prolog Language" has been modified to be compatible with the new Prolog standard. This is a graduate level text that can be used for self-study.
Affiliate links. As an Amazon Associate I earn from qualifying purchases.








one of the best texts around is "the art of prolog, advanced programming techniques" 2nd edition, by leon sterling and ehud shapiro. however, by now, it seems a bit dated (e.g. on the constraint logic programming side), so there is another recommendable…
on “Ask HN: Good books to learn Prolog?” ↗If you want to learn about Prolog, the best book IMHO is _The Art of Prolog_ by Sterling and Shapiro. The newer edition is out of print and expensive (but worth it!), the previous edition is more like $6 and will give you a good taste. _Programming in Prolog_ by Clocksin & Mellish…
on “The Prolog Story ” ↗…Peter Van-Roy and Seif Haridi ("CTM"), which covers several different programming approaches. Not about different languages, but their underlying models, and ways in which they can be combined. * The Art of Prolog, by Sterling & Shapiro - An excellent book on logic programming, using Prolog for exercises. (CTM also touches on Prolog, but this book goes quite a bit deeper.) * The Lambda papers - http://library.readscheme.org/page1.html…
on “Books that will Substitute for a Computer Science Degree” ↗…actually pretty lousy as a theorem prover, but it has a unique programming model that is very powerful for some problems. (It will also help if you want to learn Erlang later.) For Prolog, I like _The Art of Prolog_ by Sterling and Shapiro. It's on logic & declarative programming as a paradigm, and how well Prolog lives up to it. It's deep, and uses Prolog to teach about programming in general, much like SICP does…
on “Ask HN: Confused semi-newbie programmer needs some advice.” ↗…language, but I've found it really inspiring. I'm glad I didn't let that discourage me. Even if the only benefit I get from it is the insight into Erlang's design, being able to read Sterling & Shapiro's _The Art of Prolog_* , and finally getting how unification/pattern matching and type inference work, it was time well spent. * Which is awe-inspiring. I would recommend it regardless of whether you care about Prolog, much…
on “Ask HN: How to choose the right language” ↗"one of the best texts around is "the art of prolog, advanced programming techniques" 2nd edition, by leon sterling and ehud shapiro." Seconded. This is a really good book, though a bit hard to find, the last time I checked.
on “Ask HN: Good books to learn Prolog?” ↗Besides The Reasoned Schemer, another excellent logic programming book is _The Art of Prolog_ by Sterling and Shapiro. While it uses Prolog rather than Lisp, it's overall focus is more on Logic Programming than Prolog specifically. It starts with the big ideas in Logic Programming and what they're…
on “Logic Programming in Clojure” ↗I second Clause and Effect. (The Little Schemer, too, but CAE doesn't get much attention.) Sterling and Shapiro's _The Art of Prolog_ is also excellent, though you'll probably be better off reading _Clause and Effect_ first if you've never used Prolog. CAE is all about getting a feel for how Prolog operates, step-by-step* , while TAoP…
on “Ask HN: Programming books that are more like math books?” ↗…logically valid relations as possible. A major strength of Prolog is that "clean" Prolog code is extremely easy to reason about with only local context. Chcek out _Clause and Effect_ by Clocksin and _The Art of Prolog_ by Sterling and Shapiro. CAE is sort of like _The Little Schemer_ for Prolog, but has a couple larger case studies as well. TAoP is one of my absolute favorite programming books - it's got as much substance…
on “Lisper's first look at Haskell” ↗William Clocksin's _Clause and Effect_ is a similarly styled book, using Prolog. It also has a couple good case studies. I also highly recommend Sterling and Shapiro's _The Art of Prolog_.
on “99 Prolog Problems” ↗Sterling & Shapiro's _The Art of Prolog_ is fantastic, if _Learn Prolog Now_ piques your interest. Clocksin's _Clause and Effect_ is sort of like "The Little Schemer" for Prolog (though not cutesy). Also, if you learn Prolog, don't forget…
on “Learn Prolog now” ↗The Art of Prolog is now open access: https://mitpress.mit.edu/books/art-prolog-second-edition You could think of it as "SICP for Prolog".
on “Ask HN: Most interesting, mildly impractical, well-written books on software?” ↗* This book, PAIP, by Peter Norvig * SICP, by Abelson and Sussman * Lisp (3rd ed), by Winston and Horn * The Art of Prolog, by Sterling and Shapiro It's like the same book written by different authors, and all of them are good.
on “Paradigms of A.I. Programming: Case Studies in Common Lisp (1991)” ↗> "The Art of Prolog" and "The Craft of Prolog" were also two of the better programming books I have read in my life. IMHO, The Art of Prolog is along with Concepts, Techniques, and Models of Computer Programming, Paradigms…
on “The Power of Prolog” ↗I'm only eight chapters into it, but The Art of Prolog by Sterling and Shapiro has been quite good so far. It started with several chapters about logical & declarative programming, and is now getting into the Prolog language's implementation of it. Also,…
on “Prolog :- tutorial” ↗