
The craft of Prolog
by Richard A. O'Keefe · first published 1990
57mentions
18recommended by
30HN commenters
2009–2026first – last mentioned
60% recommend40% neutral
Why HN recommends it
Follow-up to The Art of Prolog that teaches writing correct, efficient Prolog: performance, difference lists and data structures with holes, and DCG parsing. Suits programmers already comfortable with the basics.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.








…it to natural language processing. The book is more difficult than Learn Prolog Now!, but if you enjoy SICP, you will enjoy this book. http://www.mtome.com/Publications/PNLA/pnla-digital.html - The Craft of Prolog by Richard O'Keefe is a must to learn writing correct efficient Prolog code. Many eye-openers. http://www.amazon.com/Craft-Prolog-Logic-Programming/dp/0262... - Warren's Abstract Machine: A Tutorial…
on “A Short Introduction to Prolog” ↗…without much experience likely just to write solutions that are age-of-universe slow because of combinatorial explosion? [0] I don't know if it's available online anywhere, but Richard O'Keefe's "The craft of Prolog" (well worth reading for anyone interested in problem solving, programmer or not) has a gorgeous explanation of how to solve the problem "find a 9-digit number such that the `n`-digit initial [or maybe…
on “An Intro to Integer Programming for Engineers: Simplified Bus Scheduling” ↗…AIMA Sandi Metz - Watch her talks Rich Hickey - Watch his talks Raymond Hettinger - Watch his live coding sections Brian Kernighan - read "The Pratice of Programming" Richard O'Keefe - read "The Craft of Prolog" John Carmack - The master of constraints and doing more by doing less Jan Weilemaker - maintainer of SWI-Prolog, read the code Linux Linus - His stubborness and meaniness has kept Linux together,…
on “Ask HN: Which programmer do you look up to?” ↗…in the second, though.) As a reference, _Programming in Prolog_ by Clocksin & Mellish is good. I also liked _Clause & Effect_ by Clocksin; it's sort of like _The Little Schemer_, but for Prolog. _The Craft of Prolog_ by O'Keefe is great, once you're comfortable with the ideas in _The Art of Prolog_. The thing that made data structures really make sense to me was learning OCaml. (_Developing Applications with Objective…
on “Ask HN: Confused semi-newbie programmer needs some advice.” ↗…a far better book for learning the same material (logic programming, declarative programming, DSLs). Whatever you think about Prolog, it's as deep a book as SICP. Seriously wonderful. (O'Keefe's _The Craft of Prolog_ is a good follow-up.) It's nice to have a hardbound copy of the newest edition, but the previous edition is available for comparatively cheap (US$6), and torrents of both seem to get around. FYI.
on “Swiss Army Knife of Unix Debugging: lsof” ↗…got as much substance as SICP. The newer edition (1994) is more expensive (though $35 used on Amazon ATM, which is a steal; it's usually more like $85-100), but adds quite a bit of new material. _The Craft of Prolog_ by O'Keefe is also good, though disorganized. (I think it was written as commentary on something else, and without that, its structure seems a bit arbitrary.) I mostly use Prolog for prototyping and…
on “Lisper's first look at Haskell” ↗…Guttag, Abstraction and Specification in Program Development Peter Norvig, Paradigms of Artificial Intelligence Programming Chris Okasaki, Purely Functional Data Structures Richard O'Keefe, The Craft of Prolog P. J. Plauger, Programming on Purpose I. (and II and III) P. J. Plauger, The Standard C Library Jef Raskin, The Humane Interface Stuart Russell and Peter Norvig, Artificial Intelligence:…
on “Which programming book you just couldn’t stop reading from start to end?” ↗Wherever "The Art of Prolog" is recommended, I'm accustomed to seeing also "The Craft of Prolog" by Richard A. O'Keefe, but here it's missing. Only the pure of heart Prolog programmer can make his way through that book!8-)) http://www.amazon.com/Craft-Prolog-Logic-Programming/dp/0262...
on “Recommended Readings in AI - a list by Russell and Norvig” ↗…-- parsing in Prolog. As usual with Wikipedia on technical topics it looks like a poor introduction, sorry. Reasoning about performance is quite possible; there's good advice in Richard O'Keefe's The Craft of Prolog. [Edit: fixed the book title, thanks to a friendly correction. The Practice of Prolog is a different book, also good, but less relevant.]
on “Writing custom type systems for Python in Prolog” ↗I haven't read "The Art of Prolog". But if you want to write correct and fast Prolog, reading "The Craft of Prolog" by Richard O'Keefe is a must.
on “Must Read CS Books For Self Self-Taught Programmers” ↗…two main ideas are global dataflow analysis and direct compilation to native code (no WAM bytecode). For a better view of the performance model, you should read Richard O'Keefe's book from 1990, The Craft of Prolog, which explains very well how to write beautiful and efficient Prolog code.
on “Ask HN: How would you modify this list of best Perlis languages?” ↗A book -- in fact, the book -- that covers this sort of thing is Richard O'Keefe's The Craft of Prolog, which, like Sterling & Shapiro's The Art of Prolog, is put out by MIT Press.
on “Lisp Prolog and Evolution” ↗…these days and still eye-opening. (It's more of a math book than a programming one, but its point is to be both.) Daniel Hillis: The Pattern on the Stone, The Connection Machine. Richard O'Keefe, The Craft of Prolog. Jon Bentley. I remember pg's On Lisp as good.
on “Ask HN: What are some of the best written programming books?” ↗For those interested in parsing with Prolog, check out Definite Clause Grammars and The Craft of Prolog. http://www.learnprolognow.org/lpnpage.php?pagetype=html&page... https://www.amazon.com/Craft-Prolog-Logic-Programming/dp/026...
on “Show HN: Writing my first interpreter in C for fun” ↗…lists give you singly-linked lists with O(1) append to the tail. Data structures with "holes" are a generalization of that idea. There's also a whole book devoted to making Prolog programs efficient: The Craft of Prolog by Richard O'Keefe.
on “WAM-CL: Common Lisp in Prolog” ↗