A review of The Little Schemer
I was about halfway through chapter 4 of SICP (Structure and Interpretation of Computer Programs), and three quarters through its video lectures when I decided to take a detour to read The Little Schemer. The book's main theme is recursion, and it teaches the reader to solve problems recursively. It also exposes the reader to interesting bits of theory. There is a demonstration of continuations, the halting problem, the Y combinator, and a Scheme-like interpreter. My motivation for reading the book was to gain an initial exposure to continuations and the Y combinator. The examples given in the book were enough to gain a cursory understanding of the significance of continuations and of Y combinators. That's a great achievement, given that the book is meant to be a basic programming book.
The book is laid out in question and answer format, with questions on the left side of each page, and answers on the right side. I found great value in covering up the answers and attempting to answer them on my own before reading the answers on the right. This did not always work well because the authors occasionally ask questions that the reader is not supposed to know how to answer at that given point in the book.
The flow of the book is excellent. It is best to read from the beginning to the end without skipping any of the chapters. The last chapter is about making a Scheme interpreter. The book contains 'commandments', which are distillations of the 'rules' of programming with recursion. The commandments are gradually built up, and finalized as the book progresses. I managed to finish the book in about three sittings, which is the minimum recommended by the authors. That's reasonable, considering the book's length (about 190 pages).
I did not actually run any of the code in the book. I did everything on paper. That said, the subset of Scheme used in the book should be able to run on most Scheme implementations. I would have used MIT Scheme or Racket (with #lang racket
) for this book.
Overall, I think books like this are excellent. They present simple examples and build up gradually. It's just the right amount of challenge. Just difficult enough that you won't get bored, and just easy enough that you won't be stuck on problems for very long. The tone is playful, with examples involving food, and with illustrations of elephants on every chapter. You don't realize how quickly you are learning because you're really having fun. It's like being a child all over again, but this time, instead of playing with wooden blocks, you're playing with programs that can be run on a computer. What's great is that the concepts learned from this books are transferable and not limited to Scheme. Knowing how to think recursively will serve you well in other programming languages too. I am sure that overall, books like this make people better programmers by exposing them to different ways of thinking about problems, and giving people an appreciation of the foundations of their craft through the glimpses of theory. I think recursion might be useful for my adventures in ML and Haskell in the future.
I am looking forward to The Seasoned Schemer after this. I am also hoping to reach The Reasoned Scheme soon. The Reasoned Schemer is the real goal. Separately, I am hoping to finish SICP soon.