
Clause and Effect
by William F. Clocksin · first published 2003
20mentions
7recommended by
8HN commenters
2008–2026first – last mentioned
88% recommend13% neutral
Why HN recommends it
Short, practical introduction to Prolog with good worked examples such as symbolic differentiation and FFT; suits people who want to start coding quickly and hit the ground running.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.







Two good books which are in the sort of style you seek are: The Little Schemer <http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/02...; and Clause and Effect <http://www.amazon.com/Clause-Effect-Programming-Working-Prog.... Also a help is that the languages they use ('use' is a more appropriate word here than 'teach') — Scheme and Prolog, respectively…
on “Ask HN: Programming books that are more like math books?” ↗If there is, by all means take it. In case there isn't, though, here are some books I've found particularly helpful teaching myself the same material. (This is a lot of reading, and they'll take time to work through. Alternating between studying theoretical stuff and working on real projects will help keep you grounded.) First off, absolutely get a copy of _Structure and Interpretation of Compute
on “Ask HN: Confused semi-newbie programmer needs some advice.” ↗I've only dabbled in Prolog so far, but enough to be able to thoroughly recommend the book Clause and Effect by Clocksin. As one of the amazon reviewers says 'It serves roughly the same purpose for the Prolog language that "The Little Schemer" serves for Scheme.' http://www.amazon.com/Clause-Effect-Programming-Working-Prog...…
on “My Life as a Prolog Implementor” ↗…generally want code to read as much like 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…
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 to learn the constraint programming extensions! SWI and GNU Prolog are free Prologs with…
on “Learn Prolog now” ↗…details. As introductions go, _The Art of Prolog_ is also a great book (like SICP great), and spends a lot of time on the logic programming paradigm and its big ideas rather than Prolog-specific details. _Clause and Effect_ by Clocksin is a _The Little Schemer_-like intro, though its style is a little more conventional.
on “Learn You Some Erlang: Three new chapters available” ↗"Clause and Effect" by Clocksin. Also, the worked exercises at Ninety-Nine Prolog Problems, https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/
on “Ask HN: Good books to learn Prolog?” ↗"SICP for Prolog" would probably be _The Art of Prolog_ by Sterling & Shapiro, mentioned above. Clocksin's _Clause and Effect_ would definitely be the _Little Schemer_ of Prolog. (No elephants or PB&J, though.)
on “Books that will Substitute for a Computer Science Degree” ↗We've already talked about _The Reasoned Schemer_ in another thread. :) I may give it a try again eventually. Clocksin's _Clause and Effect_ is a similar book, in Prolog. Monads aren't that hard, they're just one step too general - at first, it's not clear what their examples have in common. It helped when I realized I'd already written…
on “Which programming book you just couldn’t stop reading from start to end?” ↗Cleaner, yes. I picked OCaml because it seemed easier to find information about, and more widely ported. Also, I think most people fail to appreciate how useful compiler techniques are outside of "compilers". Even just knowing a little about lexing and parsing goes a long way. For Prolog, I'd also recommend _The Art of Prolog_ by Sterling & Shapiro and/or Clocksin's _Clause & Effect_.
on “What Every Computer Science Major Should Know” ↗For starting out I'd recommend Clause and Effect by Clocksin. It's a very short but practical introduction with really good examples along the way (including symbolic differentiation and FFT).
on “Why Learn Prolog in 2021?” ↗The only decent Prolog book out there, IMNSHO, is "Clause and Effect" by Clocksin. Maybe some of the later chapters might help? All the other books that I looked at were pretty awful, including the usual recommendations.
on “Stop Designing Languages. Write Libraries Instead (2016)” ↗Not even comparable. The OP posted a book, but you posted is a guide of no more than 30 pages. Novice: Adventure in Prolog Learn Prolog Now Logic Programming with Prolog Med - Advanced: Clause and Effect The Art of Prolog The Craft of Prolog Wam Book The Practice of Prolog Prolog Programming for AI - Brakto Deep Dive: Expert Systems in Prolog Natural Language Processing for Prolog Programmers Intelligent…
on “Adventure in Prolog Tutorial (2016)” ↗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…
on “Ask HN: Programming books that are more like math books?” ↗