Things written while reading The Little Schemer.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
chapter-1-toys
chapter-10-value
chapter-2-do-it-again
chapter-3-cons-the-magnificent
chapter-4-numbers-games
chapter-5-oh-my-gawd-stars
chapter-6-shadows
chapter-7-friends-and-relations
chapter-8-lambda-the-ultimate
chapter-9-again
.gitignore
README.md

README.md

Code for The Little Schemer

Things written while reading The Little Schemer.

The grand payoff of this book: the applicative-order Y combinator.

(define Y
  (lambda (f)
    ((lambda (x) (x x))
     (lambda (h) (f (lambda (g) ((h h) g)))))))

Another payoff for reading this book: the normal-order (lazy) Y combinator.

(define Y
  (lambda (f)
    ((lambda (x) (f (x x)))
     (lambda (x ) (f (x x))))))

"One of the most unique and effective pedagogic books ever written," says Bret Victor.

Code snippets closely reflect the examples offered in the various chapters of The Little Schemer. Most importantly, the examples aim to reflect the dependencies among concepts that arise naturally in the built from scratch approach that the book takes to introducing Scheme and computational fundamentals.

The use of the (require "../path/to/file.rkt) syntax of the Racket language allows ideas to touch those introduced at an earlier part of the book; an idea understood in one concept is given another opportuntity for its usefulness and applications to be appreciated.

The code was written and interactively poked and prodded using the DrRacket IDE that comes bundled with the download provided on the official Racket site. It's important to be able to follow along and code as one works through this book; Racket seems like the fastest way to get started. Simply open any of the included files in the DrRacket IDE and click Run. If the directory structure matches that of this repository, everything should work, even the various require statements. The code was written with the following modus operandi:

Write the function and test it using the REPL (Read Evaluate Print Loop) offered by the IDE, fixing things and becoming intimitely familiar with the minimal syntax of Racket along the way.

Mutually recursive applications (functions) are defined in the same file because Racket does not allow cyclical dependencies in the require statements.

See also

  • Beautiful Racket and the code written while working through Matthew Butterick's wonderful tutorials.
  • My attempt at building on Mike Vanier's blog post regarding the machinery of the Y Combinator.