Skip to content

Alice’s Adventures in Programming Language Theory Wonderland: A Short List of Computer Science/Programming/Mathematics Books in the Style of Lewis Carroll

June 10, 2011

Once upon a time, an MIT professor reputedly claimed that Alice’s Adventures in Wonderland was the best book on computer science.

While that opinion is subjective, there are a number of papers or publications related to computer science, programming, or mathematics that are written in a style that at least loosely resembles Carroll’s work.

In fact, one of the first documents that I encountered in this classification was a paper that I encountered in the Sterling Memorial Library of my college that was an academic treatise analyzing the role of logic in the humor of works by Lewis Carroll. The paper was actually written to fulfill an academic requirement (I think that it was written as a thesis for either a Master of Arts of Master of Science degree, probably in philosophy), but was actually great fun to read.

Ever since encountering that paper, I have subconsciously been searching for similar papers and publications that were associated, in some manner, with the writing style of Lewis Carroll.

One of the first books that I encountered that was written in that style was Compared to What?: An Introduction to the Anaylsis of Algorithms, by Gregory J. E. Rawlins (for some reason, my comment on the book at has apparently been borrowed, without my permission, by Google as their official review without any credit; I am not sure whether to laugh or to be annoyed). This book included numerous quotations and illustrations from works by Carroll, and, unlike many other textbooks on the design and analysis of algorithms, was written from the perspective that every problem at some point did not have a solution, and described the process that originally led up to the described algorithm.

Compared to What?: An Introduction to the Anaylsis of Algorithms

I enjoyed this book enough to wrap it in kaleidoscopic wrapping paper, and kept it in my stock until eventually moving from New York to Tokyo (one day, I hope to acquire another new copy).

Another fun-to-read book that I encountered in this style was a book on the Scheme programming language, The Little Schemer, by Daniel P. Friedman and Matthias Felleisen.

The Little Schemer, 4th Edition

The Little Schemer is actually an updated version of a previous work, The Little LISPer, also by Daniel P. Friedman and Matthias Felleisen, which had focused on recursion in Lisp. Scheme is an alternative dialect with a cleaner syntax and such changes as hygienic macros and additional features as first-class continuations.

The Little LISPer

The cover has a colorful illustration of an elephant playing with toys, and is written is a dialog style using food as a theme to teach how to think recursively with Scheme as a tool. Even the chapters within have been given such titles as “Toys,” “Cons the Magnificent,” and “Lambda the Ultimate.” At the end of the chapters are blank pages reserved for “jelly stains.”

I enjoyed this book sufficiently that I even took it with me occasionally to Kinko’s while living in Manhattan to read in order to keep the doldrums away from my studies of relational databases.

Although I was much more interested in Scheme than in Java, another related book that I also enjoyed was A Little Java, A Few Patterns, also by Matthias Felleisen and Daniel P. Friedman, which was written in a similar style. The cover has a colorful illustration of an elephant apparently serving as a waiter for two customers in a restaurant: a teacup and a Bactrian (double-humped) camel. Unlike other books on Java, this title also used that language as a tool to teach how to think recursively. The content of the work almost made Java feel like an alternative version of Scheme.

A Little Java, A Few Patterns

The Little Schemer has a sequel, The Seasoned Schemer, also by Daniel P. Friedman and Matthias Felleisen. The cover has a colorful illustration of an elephant sitting in the pilot’s seat of a biplane. This book takes off from where the prequel left off, and reportedly discusses such topics as memoization and my favorite, continuations, in the same style.

A logic programming counterpart to The Little Schemer is The Reasoned Schemer, by Daniel P. Friedman, William E. Byrd and Oleg Kiselyov. The cover has a colorful illustration of an elephant dressed in a jacket smoking a cigar as he comfortably sits in a large chair at a table on a moving train. The book discusses logic programming as a natural extension of functional programming, and assumes familiarity with the chapters up to “Lambda the Ultimate” in The Little Schemer.

The Reasoned Schemer

Of course, no account of books in this series would be complete without a reference to the work on functional programming, The Little MLer, again by Matthias Felleisen and Daniel P. Friedman. The cover has a colorful illustration of three elephants dressed as diplomats signing a treaty with three camels in front of a flag with the acronym “SML,” for “Standard ML.”

(One possible caveat: According to douglasslnc’s review, “The book does take a dramatic turn in complexity around page 81, just short of the halfway point….” I later confirmed this statement myself with a copy at a bookstore. Be careful not to wear your concentration out before you reach page 81.)

The Little MLer

Although not specifically concerned with computer science or programming, another book in the same vein is Flatland: A Romance of Many Dimensions, by Edwin Abbott Abbott. This book is especially interesting because it also doubles as a social critique of the society of Victorian England in 1884.

Flatland: A Romance of Many Dimensions

Although published 127 years ago, Flatland is worth special mention because it poignantly illustrates how a story can add significant value to a book on an otherwise potentially dry subject such as mathematics without detracting from the educational value. This work was published in 1884 in Victorian England, in a land at a time when class distinctions created social barriers between different people. Abbott draws an analogy to class distinctions by the number of angles of a polygon; the more angles, the higher the social class of the polygon within its (two-dimensional) society.

Although initially, the number of polygons is set at creation of the polygon, through intensive training, it is sometimes possible for a polygon to increase the number of its angles (similarly to how poor people occasionally become richer people in modern society). The polygon of highest social class is the circle: It has an infinite number of angles. Polygons that are almost indistinguishable from circles because they have enough angles to be, at first glance, indistinguishable from their infinite-angled brethren wind up not belonging anywhere; not being true circles, they are unwelcome among them, yet they have too many angles and are envied by their lower-angle-numbered friends. Many of them wind up becoming revolutionaries.

Another reason for recommending this story is its usefulness in motivating study of mathematics for students with mathematics phobia. As I explained in my previous post, “An Idea on A Language Version of Project Euler: Programming for Poets,” prior to matriculation, I had experienced mathematics phobia. Back then, I used to roam through the Co-op Bookstore of my college, searching for a book to tie together English literature, in which, as a later aspiring poet, I felt more comfortable, and mathematics; this was one key title that I chanced upon. I found Abbott’s approach of tying together an introduction to mathematics with a social critique of Victorian England somewhat quaint, yet also quite fascinating. This book proved instrumental in convincing me that poets (and even aspiring poets) need not fear mathematics or find it boring; there was a different kind of beauty in mathematics from that in English poetry.

Another title based on Abbott’s work that I later also found fascinating was Flatterland: Like Flatland, Only More So, by Ian Stewart.

Flatterland: Like Flatland, Only More So

Based on Flatland, Flatterland is the story of Victoria Line and her adventures in non-Euclidean space. One day, Victoria chances upon the diary of her great-great-grandfather, A. Square (the protagonist in Flatland), hidden in the attic. This encounter prompts her to invite a sphere from Spaceland for a visit (see the Wikipedia entry), but instead, she is visited by the Space Hopper, who then guides her through ten dimensions. Topics that Victoria meets upon in her travels include “fractal geometry, black holes, cosmic strings and quantum theory” (see the associated entry).

Before I wear myself out with this post, please allow me to add a reference to an interactive online programming tutorial. As many of you probably already know, most tutorials are not truly interactive; even when they are online, they merely display text in a digital counterpart form of their dead-tree brethren. In addition, most online tutorials do not have any story. However, a few years ago, I managed to find one exception, “Lists And Lists: An Interactive Tutorial,” by Andrew Plotkin. The tutorial assumes the form of a text-based adventure game with programming exercises in Scheme (the genie in the tutorial seems to discuss the Lisp programming language, but the exercises are all in Scheme).

If anybody else has any additional recommendations for this list, please add them as comments to this post!

  1. Bex Clark permalink

    My additions to your list:
    Rudy Rucker’s _The Fourth Dimension_, a meta-tale that was pleasant and accessible back in college, during a class that bridged English and math, called Dimensions I think, co-taught by Prof. Claudette Columbus and a member of the mathematics department, at Hobart & William Smith Colleges. We read Flatland as well, which was delightful. This was in 1993, and I was impressed with Columbus’ cleverness in presentation! Very engaging material. Lovely to stumble upon your blog. Best!

  2. “academic treatise analyzing the role of logic in the humor of works by Lewis Carroll” – please the name of the paper? Thank you

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: