Jump to ratings and reviews
Rate this book

The Little Schemer #2

The Reasoned Schemer

Rate this book
A new edition of a book, written in a humorous question-and-answer style, that shows how to implement and use an elegant little programming language for logic programming.The goal of this book is to show the beauty and elegance of relational programming, which captures the essence of logic programming. The book shows how to implement a relational programming language in Scheme, or in any other functional language, and demonstrates the remarkable flexibility of the resulting relational programs. As in the first edition, the pedagogical method is a series of questions and answers, which proceed with the characteristic humor that marked The Little Schemer and The Seasoned Schemer. Familiarity with a functional language or with the first five chapters of The Little Schemer is assumed.

For this second edition, the authors have greatly simplified the programming language used in the book, as well as the implementation of the language. In addition to revising the text extensively, and simplifying and revising the "Laws" and "Commandments," they have added explicit "Translation" rules to ease translation of Scheme functions into relations.

208 pages, Paperback

First published July 1, 2005

53 people are currently reading
959 people want to read

About the author

Daniel P. Friedman

16 books93 followers
Daniel P. Friedman is Professor of Computer Science in the School of Informatics, Computing, and Engineering at Indiana University and is the author of many books published by the MIT Press, including The Little Schemer and The Seasoned Schemer (with Matthias Felleisen); The Little Prover (with Carl Eastlund); and The Reasoned Schemer (with William E. Byrd, Oleg Kiselyov, and Jason Hemann).

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
103 (45%)
4 stars
86 (38%)
3 stars
30 (13%)
2 stars
6 (2%)
1 star
1 (<1%)
Displaying 1 - 15 of 15 reviews
Profile Image for Stephen Cagle.
37 reviews5 followers
April 28, 2012
I gave this book 5 stars, but as this book is in a complete category of its own, that is kind of a technicality. The Reasoned Schemer is a book that introduces you to the notion, usage, and application of logic programming. It is entirely structured in a question/answer format, which slowly introduces you to all the base "control" structures you would need in logic programming.

Non logic programming basically works from the notion of imperative data flow. This is generally represented by the concept of a function. A function takes a argument and returns a value, it takes input variables and returns output variables. A logic program creates a relation (not a function) between a set of variables. If you had a two input function, with one output, you could represent this as a logic program relation of three variables. Two of those relation variables would be what were the two inputs to the function, the third variable would be the output of the function. Here is the kicker though. You can provide concrete values for any number of those variable in any order and ask the relation what the other variables might be. At the simplest level, this means that you might run your function "backwards" (from the output to the input). But really, it means that you can ask any question relating to those variables (conceptually). Now, realistically, it is not as easy as that. Some relations may never terminate (return a answer), some grow too large and barf (overflow), some may not complete for various other reasons. It can be more complex to actually write a logical relation than a function, this must be balanced against the fact that the relation is far more powerful than the function.

If you want a primer for logical programing, this book is probably worth your time. It takes you through writing many of the fundamental parts of a logical relation. The only thing I think it really skips is the actual unification (= x y) primitive itself, which I believe it uses as a given. You can learn quite a bit by reading this code slowly and carefully. Note however, that you must complete every step of the question/answer pairings! Skimming this book will not work (unless you already know it). Really, these concepts build on each other. It is a rather small (page number and physically) book, but it will take far more time to really go through then its size would suggest. Read and work through for the purpose of understanding, and I think you will really get a good backing in logic programming, and probably enjoy yourself as well!
Profile Image for David Lindelof.
44 reviews19 followers
April 18, 2012
This third book in the "Schemer" series explores an extension to Scheme to turn it into a logic programming system. It makes no particular assumption about the reader beyond a familiarity with Scheme syntax and follows the same question/answer format of the two preceding books.

It was one of my first exposures to logic programming, and as such I found it extremely helpful to understand other textbooks I am reading on the subject currently (including an introduction to Prolog). That said, the topic is certainly alien to our usual way of thinking about programming and it took me a while before I finally grokked it.

It is by far the most difficult of the three books, and I confess skipping the most mind-blowing sections towards the end of the book. I would have appreciated a few more real-world examples of logci programming though. The authors come as far as implementing basic arithmetic, but that's about it. No solving of the tower of Hanoi, no 8-queen problem, etc.

Still, I highly recommend this book to anyone who has been through the first two.
Profile Image for Christian.
32 reviews3 followers
August 17, 2020
Logic programming from first principles, in the format of Socrates and the lyric of Scheme.
63 reviews27 followers
July 7, 2018
A surprisingly quick read, it's called "mini"Kanren for a reason!

It's well written, it's on an exciting topic, and it doesn't take more than a day or two to read so I certainly won't begrudge it some stars. I wasn't a big fan of the presentation though, I found "Programming in Prolog" much easier to read, and it covers more too, in just the first three chapters you've covered almost all of content in The Reasoned Schemer, and seen many more examples of what you can do with a relational language.

I did love Chapter 10 though; it's surprising that miniKanren can really be so small and easy. "Unication theory" is this bulking 88 page pdf and you're telling me it only takes a few dozen lines to actually implement? I now feel a lot closer to understanding languages like Prolog, and that's worth at least 4 stars?
Profile Image for Wanderson Ferreira.
32 reviews3 followers
January 12, 2020
This whole series of book is fantastic. For some reason I really like the socrastic approach of teaching using dialogues. However, my engagement with it has to be very practical in order to fully understand. In the previous book, The Little Schemer, I re-implemented the Y Combinator function to Clojure. It was a very nice and interesting adventure through that chapter.

I might come back to this book several other times. You need a break? Take Five.
Profile Image for Siddharth.
88 reviews4 followers
Read
November 11, 2020
I personally loved the first two chapters; They're insightful and exploit the nature of scheme to build really interesting relational programs. I found the chapter on arithmetic and circuits uninspired. Rather, I had a friend show me how to synthesize quines using MiniKanren, which I found far cooler.

Regardless, great book.
Profile Image for Alper Çuğun.
Author 1 book88 followers
October 8, 2022
I skimmed the last chapter because I didn’t see the point anymore. If I hadn’t read the same things explained in SICP, I would have had no idea what’s going on here.

Pity the students who were forced to study this material. The highly confusing and non-ergonomic organization of this book is not made up for by its cutesy question and answer format.
Profile Image for Mike Harris.
218 reviews4 followers
March 18, 2025
Fantastic book, my only complaint is that I wish it went into more details around the design of miniKaren along with some larger example programs.
Profile Image for Matt Diephouse.
92 reviews39 followers
July 17, 2016
I am not a fan of the method used by The Reasoned Schemer. Rather than explain and then illustrate concepts, logic programming is presented through a long series of code samples, inputs, and outputs. It's a set of examples with answers and some clarification when the authors anticipate confusion.

I found this method confusing. New ideas were given no introduction. Instead, you're expected to infer the meaning from the examples. I took a break midway through to read some papers and explanations of micro-Kanren, and those were much more helpful.

But I did find the material interesting. Logic programming has most often been presented to me in the form of Prolog. Since my work isn't primarily logic based, I haven't found it very interesting. But understanding how to build a similar library in another language seeems much more useful.
8 reviews1 follower
April 18, 2008
Logic programming is a big idea in computer science that doesn't seem to get as much attention as it should. I really liked the "The Little Schemer" (actually I read a borrowed copy of its predecessor, "The Little Lisper"), which really opened my eyes to functional programming. I was hoping this book would do the same for me with logic programming. I can't tell if it was me or the book, but I didn't have the same giddy sense of discovery that I had with the other books. However, I still liked the book, and will probably give it a second go (with a Scheme interpreter handy).
Profile Image for m00nlight.
25 reviews
February 1, 2016
Excellent book on relational programming in Scheme. It will teach you fundamental idea of pure logic programming in miniKanren language. It is also a good chance to explore different Kanren language implementation like miniKanren, muKanren etc.

This book follow the "little book series" style, using question answering to teach you the core idea, if you're a fan of other "little books", you should definitively give it a try.
Profile Image for Mitchell Kember.
15 reviews4 followers
November 1, 2014
This is a great introduction to logic programming in the spirit of The Little Schemer.
Profile Image for Brody.
100 reviews
October 28, 2015
Lots of stars but this is a super challenging read.
Displaying 1 - 15 of 15 reviews

Can't find what you're looking for?

Get help and learn more about the design.