About this book
Structure and Interpretation of Computer Programs is an introductory textbook that many experienced programmers read years after their first course and find that they understand for the first time. It was written by Harold Abelson and Gerald Jay Sussman, with Julie Sussman, and published by the MIT Press in 1985, with a second edition in 1996. For more than two decades it was the text of the first computer science course at the Massachusetts Institute of Technology, a course every student in electrical engineering and computer science took. Because of the wizard drawn on its cover, many readers call it simply the wizard book.
The book was written for first-year university students who were bright and willing to work but who did not necessarily know any programming. It assumed some comfort with mathematics, roughly at the level of a first calculus course, and many of its examples come from numerical analysis, algebra and physics. It did not assume any knowledge of a programming language. It used Scheme, a small dialect of Lisp, whose rules can be learned in an afternoon, so that the course could spend its time on ideas rather than syntax.
The question the book sets out to answer is not how to program in a particular language. It is how to think about the design of large systems built from computation, and how to control the complexity of such systems. The authors take a strong view: that computer science is not mainly about computers, any more than geometry is mainly about surveying instruments. It is about a new way of describing processes, of saying precisely how to do things. The programming language is a medium for expressing ideas about process, and programs are written first for people to read.
The book moves from very simple programs to very deep ones. It begins with arithmetic and ends by building an interpreter for its own language, and then a compiler and a simulated machine on which to run the compiled code. Along the way it covers higher-order procedures, data abstraction, symbolic computation, generic operations, state and objects, streams, nondeterministic and logic programming, and the structure of the machine itself. Few introductory books attempt so much, and few books of any kind connect the parts so well.
The full text of the second edition has for many years been freely available on the MIT Press website, which has helped the book reach far beyond the classroom. A version translated into JavaScript was published in 2022, and the book has inspired courses, rewrites and imitations in many languages.
The authors
Harold Abelson and Gerald Jay Sussman were professors at MIT, closely associated with its Artificial Intelligence Laboratory and its tradition of Lisp programming. They developed the introductory course from the late 1970s and taught it together for many years. Julie Sussman, a writer and editor with a background in computing, worked with them on the text and is credited on the title page.
Harold Abelson
Abelson trained as a mathematician. Before this book he was known for his work on Logo, the programming language designed for children, and with Andrea diSessa he wrote Turtle Geometry, a book that teaches mathematics through programs that move a turtle around a screen. That background shows in the present book: a belief that programming is a way to explore and understand mathematical ideas, not just a technical skill. Abelson later became widely known for his work on the public side of computing, as a founding director of Creative Commons and of the Free Software Foundation, and for leading the development of App Inventor, a visual programming system for beginners.
The course behind the book
The book grew from the MIT course that its authors taught to large first-year classes, and its character reflects that setting. The course aimed to give every engineering student, not just future computer scientists, a common way of thinking about systems. Students wrote programs every week, many of them substantial, and the lectures presented the ideas that the programs exercised. The text was refined through years of use, and the second edition revised many sections in light of that teaching experience. This history explains why the book reads as a sequence of lessons that build on each other rather than as a reference work: each part was tested on real students before it reached print.
Gerald Jay Sussman
Sussman worked in artificial intelligence, electrical circuit analysis and the design of programming languages. With Guy Steele he invented Scheme in the mid-1970s, in a series of papers that explored how a small Lisp with lexical scope and first-class procedures could express a wide range of programming ideas. Scheme was born partly as an attempt to understand the actor model of computation, and its creators found that the same small core could explain control structures, objects and much else. Sussman later wrote, with Jack Wisdom, Structure and Interpretation of Classical Mechanics, which applies the same style of thinking to physics, and with Chris Hanson a book on designing flexible software. He also worked on special-purpose computers for computing the long-term motion of the planets.
What they brought to the book
The authors combined deep experience in language design with a mathematician's taste for clean structure and a teacher's sense of what students can be led to see. They did not regard the introductory course as a place for watered-down material. They believed beginners could grasp powerful ideas if those ideas were presented clearly and built up in the right order. That belief shapes everything in the book.
They also recorded a set of lectures based on the course in 1986, given to an audience of programmers from industry. The recordings have circulated widely and are still watched. They are a good companion to the book, because the authors' enthusiasm and humour come through more strongly on film than on the page.
The shape of the argument
The book has five chapters, and their order carries an argument. Each chapter introduces a new way of controlling complexity and shows what new kinds of program it allows. Each also shows the price of that new power. Together they build up a picture of programming as layered design, and then turn the picture inward to show how the language itself is built.
From procedures to data
The first chapter is about procedures: how to combine simple operations into compound ones, how to give them names, and how to treat them as values that can be passed around and returned. It introduces a simple model of how programs run, by substituting values for names, and uses it to study how much time and space processes need. The second chapter does the same for data. It shows how to build compound data from simple parts, how to hide representation behind a set of operations, and how to make systems that handle many different kinds of data through a common interface.
Time and change
The third chapter introduces assignment, the ability to change the value of a variable. This brings objects with state, and with them a whole set of difficulties: the simple substitution model breaks down, identity becomes subtle, and the order of events matters. The chapter introduces a more detailed environment model of evaluation to cope with this, studies simulation and concurrency, and then offers a different approach to change based on streams, which model a changing quantity as an unfolding sequence of values.
Languages as tools
The fourth chapter makes a striking turn. Having used Scheme throughout, the authors write an evaluator for Scheme in Scheme. They then modify it to create new languages: one with lazy evaluation, one that searches automatically among alternatives, and one that does logic programming by matching patterns against a database of facts and rules. The lesson is that a language is not a fixed thing handed down. It is a program, and a programmer can build new languages to suit new problems.
Down to the machine
The fifth chapter descends to the level of the machine. It describes a simple register machine, builds a simulator for it, and then writes an evaluator for Scheme in the register machine's language. It covers how memory is managed and how unused memory is reclaimed. It ends with a compiler that translates Scheme programs into register machine code. By the end, the reader has seen every layer from abstract ideas down to the elementary operations of a machine, and seen that each layer is built from the one beneath.
The book is dense. Its exercises are a central part of the teaching, and many of the most important ideas emerge from them rather than from the main text. A reader who skips the exercises gets a tour; a reader who does them gets an education.
The role of the exercises
The exercises deserve a word of their own. They are not drills. Many introduce ideas that the text uses later, so a reader who skips them will sometimes find a later section assuming something never explained in the main prose. Some are short checks of understanding; others are substantial projects, such as extending a system with a new kind of data or a new language feature. Several ask the reader to predict what a program will do and then explain why, which trains exactly the skill of seeing the process behind the text. The best way to use them is to attempt each one honestly, write the answer down, run it, and only then compare with other solutions.
Idea one: abstraction as the central tool
The organising idea of the book is that complexity is controlled by abstraction. A complex system cannot be held in the mind all at once. The way to build one is to construct pieces that do well-defined jobs, give them names, and then use them as if they were primitive, forgetting how they work inside. Each layer of a system speaks a language built from the layer below.
The authors name three mechanisms that every powerful language provides. First, primitive expressions, the simplest things the language can do. Second, means of combination, by which compound elements are built from simpler ones. Third, means of abstraction, by which compound elements can be named and treated as units. They return to this triple many times, applying it to procedures, to data and finally to languages themselves.
An everyday analogy
Think of how a city is organised. A traveller does not need to know how trains are built to use a railway, and an engineer designing a bridge does not need to know the timetable. Each person works with a level of the system through a small set of well-understood operations: buy a ticket, board, alight; or bear this load, span this distance. The power of a large system comes from these clean boundaries. When a boundary leaks, and one must suddenly know details from another level to get anything done, complexity floods in.
The book's examples make the same point in code. A procedure that computes a square root by repeated improvement can be used without knowing the method inside. A representation of rational numbers can be changed without disturbing the programs that add and multiply them. A program that manipulates algebraic expressions can be built on top of generic arithmetic that works on many kinds of number.
What it is often confused with
Abstraction in this sense is not the same as vagueness, nor as generality for its own sake. A good abstraction is precise: it has a clear contract, a small set of operations with well-defined behaviour. It is also not the same as the object-oriented class hierarchies that became fashionable in the 1990s, though those are one way to build abstractions. The book is careful to present several ways of building abstraction and to show the strengths and limits of each.
Idea two: procedures as values
The first chapter's most important idea is that procedures can be treated like any other value. They can be passed as arguments to other procedures, returned as results, and stored in data structures. Procedures that take or return procedures are called higher-order procedures. The authors use them to capture general patterns of computation that would otherwise be repeated in many places.
A simple example makes this clear. Suppose you write one procedure to add up the integers from a to b, another to add up their squares, and a third to add up a series that approximates some constant. The three procedures share a common shape: start at a, compute some term, move to the next value, stop at b, and add everything together. Only the term and the step differ. By writing a single summation procedure that takes the term and the step as arguments, you capture the shape once. Each of the original procedures becomes a one-line use of it.
The authors then go further. They write procedures that return procedures: one that takes a function and returns its approximate derivative, one that finds fixed points of functions, one that turns a guess-improving step into a complete iterative method. From these they build Newton's method for solving equations in a few lines, by composing general tools. The effect is to show that the programmer can build a vocabulary of general methods and then express specific computations as combinations of them.
Why it matters
Higher-order procedures are the programmer's version of the mathematician's habit of generalising. They make it possible to name ideas that sit above individual calculations, such as accumulation, filtering, mapping, iterative improvement and search. Once named, these ideas can be used, combined and reasoned about. Languages that make procedures first-class values, as Scheme does, allow this naturally. Many languages that did not support it in 1985 have since added it, often under the name of lambda expressions or closures.
Where it leads
The idea of passing procedures around leads directly to the later chapters. Data can be represented as procedures. Objects with state can be represented as procedures that remember values. An evaluator is a procedure that takes an expression and an environment and returns a value. The whole book can be read as an extended demonstration of how much can be built from procedures as values.
Idea three: processes and their shapes
A program is a static text. When it runs, it generates a process, a pattern of activity unfolding in time. The book insists that a programmer must learn to see the process behind the program, and in particular its shape: how much time it takes, how much memory it needs, and how these grow as the input grows.
The authors make a careful distinction that confuses many beginners. A procedure that calls itself is recursive in its text. But the process it generates may be either recursive or iterative. A recursive process builds up a chain of deferred operations, like a stack of plates waiting to be washed, which must be remembered until the end. An iterative process carries its whole state in a fixed number of variables, like a running total, and can be stopped and resumed at any point by recording those variables. Both can be written as procedures that call themselves. The difference is in what has to be remembered.
An example
Consider computing a factorial. One way multiplies n by the factorial of n minus one, which requires waiting for the smaller factorial before doing the multiplication. The number of waiting multiplications grows with n. Another way keeps a running product and a counter, multiplying and counting up until the counter passes n. At every step the whole state is in those two numbers. Both are written as self-calling procedures. The first generates a recursive process whose memory grows with n; the second generates an iterative process whose memory stays constant. Scheme guarantees that the second will run in constant space, a property called proper tail recursion.
Orders of growth
The book introduces the idea of an order of growth, a rough measure of how resources scale with input size. It compares procedures for computing powers, greatest common divisors, Fibonacci numbers and primality tests. A naive tree-recursive method for Fibonacci numbers grows exponentially; a simple iterative one grows linearly. Successive squaring computes powers in logarithmic time. A probabilistic primality test based on Fermat's little theorem runs fast but can, in rare cases, be fooled. These examples teach a habit of mind: before running a program, estimate its cost.
This idea connects the book to the analysis of algorithms. It does not go deep into that subject, but it plants the seeds. A reader who later meets Knuth or Cormen, Leiserson and Rivest will recognise the questions.
Idea four: data abstraction and the barrier
The second chapter applies abstraction to data. Its central example is rational numbers. A program that works with fractions needs to make them, to extract numerators and denominators, and to add, subtract, multiply and divide them. The authors build this in layers. At the bottom, a fraction is stored as a pair of integers. Above that, a few procedures construct a fraction and select its parts. Above that, arithmetic is written using only those constructors and selectors. Above that, programs use arithmetic without knowing how fractions are stored.
The boundaries between these layers are called abstraction barriers. The rule is that each layer may use only the operations of the layer immediately below. If one decides later to store fractions in lowest terms, or to reduce them only when printing, one changes only the bottom layer. Nothing above it needs to change. This separation of use from representation is the most practical lesson in the whole book.
What is data, really?
The authors then ask a deeper question. What does it mean to be a pair? One might think a pair is a block of memory with two slots. The book shows that a pair can be defined purely by its behaviour: anything that provides a way to construct a pair from two values and to get each value back, satisfying the obvious rules, will do. They then build pairs out of nothing but procedures. A pair becomes a procedure that, given a request for the first or second part, returns it. Data, in this view, is defined by the operations on it and the laws they obey.
This is a surprising and powerful idea. It blurs the line between data and program and anticipates the later chapters, where objects are built from procedures and an evaluator treats programs as data. It also connects with mathematics, where structures are often defined by what one can do with them rather than by what they are made of.
Closure and hierarchical data
Pairs can contain other pairs. This property, that the means of combination produces things that can be combined again, the authors call closure. It allows lists, trees and arbitrarily nested structures to be built from a single primitive. The chapter shows how to process such structures with higher-order procedures that map, filter and accumulate over them. A memorable example is a small language for drawing pictures, based on work by Peter Henderson, in which simple images are combined by operations such as beside, below and flip, and in which the combinations are themselves images. The picture language shows closure at work in a visual way, and it introduces the idea of a small language embedded inside a larger one.
Idea five: many representations, one interface
Real systems must often handle several representations of the same kind of thing. Complex numbers can be stored in rectangular form, as real and imaginary parts, or in polar form, as magnitude and angle. Each form makes some operations easy and others awkward. A system may need both. The question is how to write programs that work with complex numbers without caring which form a particular number uses.
The book presents three strategies. In the first, each piece of data carries a tag saying what kind it is, and each generic operation checks the tag and dispatches to the right specific procedure. This is simple but means that every generic operation must know about every representation, so adding a new representation requires editing many procedures.
In the second, called data-directed programming, the system keeps a table indexed by operation and by type. To perform an operation on a piece of data, it looks up the right procedure in the table. Adding a new representation means adding entries to the table, without changing existing code. Adding a new operation means adding a new row.
In the third, called message passing, each piece of data is itself a procedure that knows how to perform operations on itself. To ask a complex number for its magnitude, one sends it the message magnitude, and it answers. Adding a new representation means writing a new kind of object, without touching others.
Why it matters
These three strategies correspond to tensions that run through software design to this day. Organising code by operation makes it easy to add new operations but hard to add new types. Organising code by type, as in message passing and object-oriented programming, makes it easy to add new types but hard to add new operations. Table-driven designs sit between. The book does not declare a winner. It shows the trade-offs and lets the reader see that the choice depends on how the system is likely to grow. This is a far more useful lesson than any single doctrine.
The chapter culminates in a generic arithmetic system that handles ordinary numbers, rational numbers and complex numbers through one interface, and then in a system for symbolic algebra that manipulates polynomials whose coefficients can themselves be any kind of number in the system, including other polynomials. The design shows how generic operations compose into layered systems of real power.
Idea six: the cost of change
For two chapters, the book uses no assignment. Variables are names for values, and once a name is bound it never changes. This style, now called functional programming, has a great advantage: a procedure always gives the same result for the same arguments, so one can understand a program by replacing names with their values, step by step, like simplifying an algebraic expression.
The third chapter introduces assignment, the ability to change what a name refers to. The authors show why one would want it. A bank account has a balance that goes down as money is withdrawn. A random number generator must remember where it is in its sequence. Modelling such things without assignment forces the state to be passed explicitly through every procedure that might need it, which spreads knowledge of internal details across a system. With assignment, an object can keep its own state and present a clean interface to the world.
What is lost
But assignment has a cost, and the book is unusually honest about it. Once values can change, the substitution model of evaluation no longer works. A name no longer stands for a value; it stands for a place where a value is kept, and what is in that place depends on when one looks. Two expressions that look the same may give different results at different times. The question of whether two objects are the same becomes subtle: two bank accounts with the same balance are not the same account, and changing one must not change the other.
An analogy helps. In a world without change, a name is like a label on a fixed photograph. In a world with change, a name is like a label on a window, and what you see through it depends on the moment. Reasoning about photographs is easy. Reasoning about windows requires keeping track of time.
The environment model
To replace the substitution model, the book introduces the environment model of evaluation. An environment is a sequence of frames, each a table of names and values, linked to an enclosing environment. Evaluating an expression means looking up names in the current environment, searching outward through the frames. Applying a procedure creates a new frame binding its parameters, linked to the environment where the procedure was defined. This model explains how procedures can carry private state, how local names hide outer ones, and how closures remember the context in which they were created. It is also the model the later evaluator implements.
Mutable data and simulation
With assignment available, the chapter builds mutable data structures such as queues and tables, and then two substantial simulations. One simulates digital circuits, with wires that carry signals and gates that respond after a delay, driven by an agenda of scheduled events. The other builds a system for propagating constraints, in which a network of relations can compute any unknown quantity from the known ones, so that a temperature conversion works in either direction. These examples show how objects with state can model physical systems naturally.
Concurrency
The chapter then looks at what happens when several processes change shared state at once. Two withdrawals from the same account, interleaved badly, can leave the balance wrong. The book explains why and introduces mechanisms for controlling the order of events, such as serialising access to shared data. It is a short treatment, but it shows clearly why concurrency is hard: once state and time interact, the number of possible orderings explodes, and each must be considered.
Where this debate went
The tension this chapter sets out, between the convenience of objects that change and the clarity of values that do not, has shaped programming ever since. Object-oriented languages took the first path and became dominant in industry through the 1990s. Functional languages took the second and stayed mostly in research and teaching for a long time. More recently the balance has shifted. Multi-core processors and distributed systems made shared mutable state a frequent source of errors, and many mainstream languages and frameworks now encourage immutable data, pure functions and explicit handling of change. A reader who absorbs this chapter will recognise the same trade-off in modern debates about state management in user interfaces, databases that keep a log of events rather than overwriting records, and the design of concurrent systems. The book did not settle the question, but it stated it with unusual clarity at the level of a first course.
Idea seven: streams and the shape of time
After showing the difficulties that assignment brings, the book offers an alternative way to model change. Instead of an object whose state changes over time, one can model the whole history of a quantity as a sequence of values. A bank account becomes the stream of its balances. A sensor reading becomes the stream of its measurements. Change is represented not by updating a variable but by moving along a sequence.
The difficulty is that such sequences may be very long or infinite. The book solves this with delayed evaluation. A stream is a pair whose first element is computed but whose rest is a promise to compute the remainder when needed. Only the parts of the stream that are actually used are ever computed. This makes it possible to define infinite streams, such as the stream of all integers or all primes, and to process them with the same mapping, filtering and accumulating operations used on lists.
An example
Imagine wanting the hundredth prime number. One approach writes a loop that counts and tests numbers until it finds a hundred primes. Another defines the stream of all integers, filters it to the stream of all primes, and takes the hundredth element. The second approach separates what is wanted from how far to compute. Delayed evaluation ensures that only as much of the infinite stream as necessary is ever built. The authors use streams to express numerical methods, signal processing and even the sieve of Eratosthenes with great elegance.
Why it matters
Streams show that time in a program need not be the same as time in the world being modelled. With assignment, the program's sequence of events mirrors the world's. With streams, the whole history is a mathematical object that can be manipulated as a whole. This is a deep idea. It foreshadows lazy functional languages such as Haskell, the reactive programming styles used in modern user interfaces and data pipelines, and the general notion of treating event histories as data.
Where it gets hard
The book does not oversell streams. It shows that they fit awkwardly with assignment, since a delayed computation may run at a surprising time and see a surprising state. It also shows that modelling interacting objects, such as two people sharing a bank account, raises questions about merging streams in a way that respects the order of real events, which brings time back in. The chapter ends with this tension unresolved, which is honest. The choice between objects and streams remains a real design decision.
Idea eight: the evaluator is just a program
The fourth chapter is the summit of the book, and it carries its most important lesson. The authors write an evaluator for Scheme in Scheme. They call it metacircular, because it uses the language to define itself. It is only a few pages long. At its centre are two procedures that call each other. One evaluates an expression in an environment: if the expression is a number, return it; if it is a name, look it up; if it is a special form such as a definition or conditional, handle it by its rule; if it is a procedure call, evaluate the operator and the operands and then apply. The other applies a procedure to arguments: if the procedure is primitive, call the underlying machine; if it is compound, evaluate its body in a new environment that binds its parameters.
The two procedures form a cycle of evaluation and application that the authors present as the essence of how programming languages work. Expressions are reduced to procedures and arguments; procedures are applied to arguments, which leads to evaluating their bodies, which are expressions. The whole language rests on this loop.
Following one expression through
It helps to trace a single small case by hand. Suppose a procedure named double has been defined to add its argument to itself, and the evaluator is asked for the value of double applied to the sum of two and three. The expression is a procedure call, so the evaluator first evaluates the operator, the name double, by looking it up in the environment, and finds a compound procedure: a list of parameters, a body, and the environment where it was defined. It then evaluates the operand. That is itself a call, so the cycle runs again in miniature: the name for addition is found to be a primitive, the numbers evaluate to themselves, and the primitive is applied to give five. Now the evaluator applies double to five. It makes a new frame binding the parameter to five, links that frame to the procedure's defining environment, and evaluates the body there. The body is another call to addition, whose operands both look up the parameter and find five. The primitive gives ten.
Nothing in this trace is mysterious, and that is the point. Every step is one of a handful of cases. A reader who traces a few such examples by hand, drawing the frames as boxes and the links as arrows, will find that the environment model of the third chapter and the evaluator of the fourth are the same thing seen twice: once as a way of reasoning, once as a program.
Why it is so powerful a lesson
Most programmers treat their language as given, a fixed set of rules handed down by its designers. The metacircular evaluator dissolves this. It shows that a language is defined by a program that interprets it, and that the program is short and comprehensible. Once you have seen this, you understand that every feature of a language corresponds to some decision in an evaluator, and that you could make a different decision. Questions such as when arguments are evaluated, how names are looked up and what happens on an error stop being mysteries. They become choices.
An analogy helps. A person who has only ever followed recipes thinks of cooking as a list of instructions. A person who understands why each step works, what heat does to protein and acid does to colour, can invent new dishes. The evaluator is the moment where the reader passes from following the recipes of a language to understanding cooking.
What it is often confused with
The metacircular evaluator is sometimes dismissed as a trick, since it relies on the host language to do much of the work, for example in arithmetic and memory management. That is true and the authors say so. Its point is not to implement Scheme from scratch but to make explicit the rules of evaluation, separating them from the details that the host provides. The fifth chapter then removes even that reliance.
Idea nine: building new languages
Once the evaluator is in hand, the authors modify it to create languages with different rules. This is where the book's idea of metalinguistic abstraction, the design of new languages as a tool for solving problems, comes alive.
Lazy evaluation
The first variation changes when arguments are evaluated. In ordinary Scheme, arguments are evaluated before a procedure is applied. In the modified language, arguments are passed unevaluated and computed only when their values are actually needed. A small change to the evaluator produces a language in which streams no longer need special treatment, since every list is automatically lazy. The example shows how a single design decision in an evaluator changes the character of a whole language.
Nondeterministic search
The second variation adds a construct that chooses among several alternatives and an automatic mechanism that backs up and tries another choice when a later requirement fails. With this, a programmer can state a problem as a set of choices and constraints, and the evaluator searches for an assignment that satisfies them. Logic puzzles and simple natural-language parsing can be written in a few lines. Underneath, the evaluator keeps track of where to return if a choice fails, using procedures that represent what remains to be done. This introduces, gently, the idea of continuations, a powerful notion in programming language theory.
Logic programming
The third variation is the most different. The authors build a query system in which the programmer states facts and rules about relationships, and then asks questions. The system answers by matching patterns and unifying variables, in the style of the language Prolog. Instead of describing how to compute an answer, the programmer describes what is true, and the system finds the answers. The example is a database about employees in a company, with rules such as who supervises whom, and queries that can run in several directions.
The book is candid about the limits of this approach. The query system's logical operators do not behave exactly like those of logic, and the order in which rules are written can lead to infinite loops. These limits are instructive. They show that the gap between stating what is true and computing it is real, and that every logic programming system makes compromises.
Why it matters
The three variations make the book's deepest claim concrete: that a programmer's most powerful tool is the ability to design a language suited to the problem. A large system is often best built as a set of small languages, each fitting its part of the problem, rather than as a single mass of code in a general language. This idea, sometimes called the design of domain-specific languages, appears in configuration languages, query languages, build systems, hardware description languages and many other places. The book makes it seem natural rather than exotic.
Idea ten: down to the machine
The fifth chapter completes the descent. It asks what a real machine does when it runs a program, and answers by describing a simple register machine: a set of registers that hold values, a few basic operations, a stack, and a controller that steps through a sequence of instructions, including tests and jumps. The authors write a simulator for such machines in Scheme, so that the reader can design machines and run them.
They then write an evaluator for Scheme in the language of the register machine. This explicit-control evaluator makes visible everything that the metacircular evaluator left to its host: how the stack grows and shrinks, how procedure calls save and restore registers, and why some calls need no stack space at all. The property of proper tail recursion, introduced in the first chapter, now has a concrete explanation in terms of what is saved and what is not.
Memory and its reclamation
The chapter also explains how list structure is stored in a memory of numbered locations, and how a system can automatically reclaim memory that is no longer in use. It presents a copying garbage collector, which moves all reachable data into a fresh area of memory and abandons the rest. The idea that a language can manage memory automatically, so that the programmer need not free each object explicitly, was well established in Lisp but rare in mainstream languages in 1985. It is now standard.
Compilation
Finally, the chapter builds a compiler that translates Scheme expressions into register machine instructions ahead of time, avoiding much of the work an interpreter repeats at every step. The compiler is related closely to the explicit-control evaluator: it performs the same analysis, but once, producing code instead of actions. The authors show how compiled and interpreted code can call each other, and they compare their efficiency.
Why it matters
By the end of the chapter, the reader has seen the whole stack of a computing system. Abstract ideas are expressed as procedures; procedures are evaluated by an evaluator; the evaluator is itself a program running on a machine; the machine executes simple instructions; and a compiler can translate from the top to the bottom. Nothing is magic. This is a rare thing for an introductory course to achieve, and it gives the reader a lasting confidence that any system, however complex, can be understood layer by layer.
The tradition around it
The book grew from the Lisp tradition at MIT. Lisp was created by John McCarthy in the late 1950s, partly as a notation for computing with symbolic expressions and partly as a way of making recursive functions practical. A famous early result showed that a Lisp evaluator could be written in Lisp in a page, and the idea of the metacircular evaluator descends directly from it. Lisp's roots go further back, to Alonzo Church's lambda calculus of the 1930s, which appears in The Undecidable on this shelf. Scheme was a deliberate return to the lambda calculus, with lexical scope and procedures as first-class values.
The book also draws on the tradition of structured and disciplined programming. Dahl, Dijkstra and Hoare's Structured Programming, on this shelf, argued in 1972 that programs should be built from well-understood parts with clear interfaces and that correctness should be a design goal rather than an afterthought. SICP shares this aim but approaches it through abstraction and language design rather than through control structures and proof. Its treatment of data abstraction parallels Hoare's and Dahl's work on abstract data types and the class concept of Simula.
Neighbours on the shelf
Knuth's The Art of Computer Programming treats algorithms with great depth and precision, using a low-level machine language for its examples. SICP covers fewer algorithms but more ways of structuring programs. The two complement each other: Knuth teaches what to compute and at what cost, SICP teaches how to organise the computation. Kernighan and Ritchie's The C Programming Language represents an almost opposite philosophy: a small language close to the machine, with manual memory management and little built-in abstraction. Reading the two side by side shows two coherent but different answers to the question of what a programmer needs.
Aho, Sethi and Ullman's Compilers: Principles, Techniques, and Tools goes far deeper into the construction of compilers than SICP's fifth chapter, covering parsing, optimisation and code generation for realistic languages. SICP is a good preparation for it, since it makes clear what a compiler is for before the details arrive. Hopcroft and Ullman's Introduction to Automata Theory, Languages, and Computation and Sipser's Introduction to the Theory of Computation give the theoretical side of languages and machines. Hofstadter's Gödel, Escher, Bach explores self-reference and formal systems in a way that resonates with the idea of a language interpreting itself. Minsky's Computation: Finite and Infinite Machines treats machines and computability from the same MIT tradition a generation earlier.
Brooks's The Mythical Man-Month addresses complexity from the side of project management and team organisation, and makes a useful companion to SICP's technical approach to the same problem. Cormen, Leiserson and Rivest's Introduction to Algorithms takes up the analysis of efficiency that SICP only introduces. Petzold's Code describes, from the hardware up, the layers that SICP describes from the top down.
What came after
SICP influenced a generation of courses and books. Some built on it directly; others reacted against it. In the 1990s Matthias Felleisen and colleagues argued that SICP assumed too much mathematical background and did not teach a systematic method for designing programs, and they wrote How to Design Programs as an alternative, also in a Scheme dialect. At MIT itself the introductory course was replaced around 2008 by one based on Python and focused on robotics and engineering systems. Sussman explained the change partly as a response to the way programming had shifted from building systems from small, well-understood parts to assembling large libraries whose behaviour must be discovered by experiment.
It is worth being clear about what this change did and did not mean. It was not a judgement that the book's ideas were wrong. It reflected a view about what a first course for engineers should emphasise in a world where most software is assembled from existing parts. Many universities continued to teach from SICP or from courses closely modelled on it, and the ideas it introduced remain part of advanced courses on programming languages almost everywhere.
Yet the book has lived on. It is used in courses around the world, studied by self-learners, and translated into other languages, including a JavaScript edition published in 2022. Its ideas, such as higher-order procedures, closures, lazy evaluation, data-directed design and the evaluator as a program, have become part of mainstream programming. Many popular languages that lacked them in 1985 have since adopted them.
Questions and criticisms
SICP is widely admired, but it has also been criticised, and a reader should know both.
The mathematical bias
Many of the book's examples come from mathematics: square roots, fixed points, Newton's method, series approximations, symbolic differentiation, polynomial arithmetic. For students with strong mathematical backgrounds these are natural. For others they can be a barrier, and some critics argue that the book teaches mathematics as much as programming. The second edition softened this somewhat, but the character remains. A reader who struggles with the mathematics should not conclude that the programming ideas are beyond them; the ideas can be grasped with simpler examples.
Too little method
Felleisen and others argued that the book shows brilliant programs but does not teach a step-by-step method for constructing them. A beginner sees the elegant result but not the process of getting there. How to Design Programs tried to fill this gap with explicit design recipes. This is a fair point. SICP is better at showing what good design looks like than at teaching how to achieve it from a blank page. The exercises help, but many readers benefit from a more explicit method alongside.
The choice of language
Scheme is ideal for the book's purposes: small, regular and powerful. But it is little used in industry, and some students find its parenthesised syntax off-putting. The ideas transfer to other languages, as the JavaScript edition shows, but sometimes with loss of clarity, since many languages make the distinction between statements and expressions or between procedures and data more awkward. A reader working in another language should expect some friction.
What has aged
Some parts reflect the computing of the 1980s: the register machine model is simple compared with modern processors, the treatment of concurrency is brief, and there is little on networks, large-scale software engineering, testing or the use of libraries. The book's world is one in which a programmer builds systems from small parts they fully understand. Modern programming often involves combining large components whose internals are opaque. SICP's lessons still apply, but they must be adapted to that reality.
What has held up
The central ideas have held up remarkably well. Abstraction barriers, higher-order procedures, the trade-offs between representations, the costs of state, the value of streams and the evaluator as a program are all as relevant today as in 1985. Many have become more relevant as functional programming ideas have spread. The book's insistence that programs are written for people to read has aged into common wisdom. Its ability to make a reader see the whole of a computing system, from ideas to machine, remains unmatched by most introductory texts.
Why it is on this shelf
This shelf gathers books that teach how to think about structure: the structure of the self in Vedanta, of the heavens in Jyotish, of nature in science, of exchange in economics and of machines in technology. SICP belongs here because it is about structure in its purest form. It teaches that complex things are understood through layers, that each layer has its own language, and that the deepest understanding comes from seeing how those languages are themselves built.
There is a striking parallel with the older traditions on this shelf. Vedanta asks what lies behind the layers of experience and how the knower relates to what is known. SICP, in its fourth chapter, shows a language interpreting itself, a system that contains its own description. The analogy should not be pressed too far, but a reader of both will find that the habit of looking beneath the surface of a system to the rules that generate it is common to them. Jyotish, likewise, is a body of rules for computing and interpreting patterns, and a reader who has written an evaluator will see any such body of rules with fresh eyes.
We keep it also because it changes how one reads every other book about computing. After SICP, a programming language is no longer a fixed tool but a design, and a program is no longer a list of commands but an expression of ideas about process. That shift of view is the most valuable thing a book on programming can give.
How to read it
SICP is not a book to read quickly. It is a book to work through, with an interpreter open and a notebook beside it. A realistic pace for a self-learner is a few months, working several hours a week.
Setting up
Install a Scheme or Racket system. Racket has a package that supports the book's dialect closely. Type in the examples as you read them and run them. Change them and see what happens. Do not read the code without running it.
Chapter one, slowly
Read the first chapter carefully and do most of its exercises. Pay special attention to the difference between recursive and iterative processes, and work out by hand, on paper, the shape of each process for small inputs. Then study the sections on higher-order procedures until writing a procedure that takes or returns a procedure feels natural. This chapter is the foundation, and time spent on it is repaid many times.
Chapter two, selectively
Read the sections on rational numbers, abstraction barriers and hierarchical data carefully, and do the exercises on lists and trees. Enjoy the picture language. On a first pass, read the sections on generic operations for their ideas, and do a few exercises on data-directed programming, but do not feel obliged to build the full symbolic algebra system.
Chapter three, for ideas
Read the sections on assignment, the environment model and streams with great care. Draw environment diagrams for the examples until you can predict what any small program will do. The simulations of circuits and constraints are worth reading but can be skimmed on a first pass. Do several stream exercises, since they change how one thinks about sequences and time.
Chapter four, the heart
Read the metacircular evaluator slowly and type it in yourself. Run it. Add a new special form. Change the order of argument evaluation and observe the effect. Then read the lazy evaluator and the nondeterministic evaluator. The logic programming section can be read later. Many readers say this chapter changed how they think about programming, and it is the one to protect time for.
Chapter five, as the finale
Read the register machine sections and the explicit-control evaluator to see the machine beneath the language. The compiler can be left for a second reading. If time is short, read the chapter for its overall picture rather than every detail.
Companions
Watch the 1986 video lectures alongside the reading. They cover the same ground with energy and humour. Many readers also benefit from working with others, or from comparing their exercise solutions with the many published online, after making an honest attempt first.
What to read next from this shelf
For algorithms and their analysis, read Introduction to Algorithms, then dip into Knuth's The Art of Computer Programming. For a contrasting view close to the machine, read The C Programming Language. For the full art of compilers, read Compilers: Principles, Techniques, and Tools. For the theory of languages and machines, read Sipser's Introduction to the Theory of Computation. For the logical roots of the lambda calculus, read the papers by Church and Turing in The Undecidable. For design at the scale of teams and projects, read The Mythical Man-Month.
Questions to carry
- What are the three mechanisms every powerful language provides, and how does the book apply them to procedures, data and languages?
- How can a procedure that calls itself generate an iterative process, and why does it matter?
- What patterns of computation can be captured by a single higher-order procedure?
- Why does an abstraction barrier let a representation change without breaking the code above it?
- In what sense can a pair be defined by behaviour alone, and what does that say about data?
- When would you choose data-directed programming over message passing, and why?
- What exactly breaks in the substitution model once assignment is allowed?
- How does the environment model explain a procedure that keeps private state?
- Why do streams let a program's time differ from the time of the world it models?
- What decisions in the metacircular evaluator define the character of the language?
- How does one small change to the evaluator produce a lazy language?
- What does automatic backtracking add, and what does it cost?
- Why is logic programming not quite logic?
- What does the explicit-control evaluator reveal that the metacircular evaluator hides?
- When should a problem be solved by designing a new small language rather than writing more code?
Words to know
- Abstraction: naming a compound thing and using it as a unit while ignoring how it works inside.
- Abstraction barrier: a boundary between layers of a system, crossed only through a defined set of operations.
- Scheme: a small dialect of Lisp with lexical scope and first-class procedures, used throughout the book.
- Lisp: a family of programming languages, begun by John McCarthy in the late 1950s, built on symbolic expressions and lists.
- Procedure: a named, reusable description of a computation that takes arguments and returns a value.
- Higher-order procedure: a procedure that takes procedures as arguments or returns them as results.
- Lambda expression: an expression that creates a procedure without necessarily naming it, from Church's lambda calculus.
- Closure: a procedure together with the environment in which it was created; also, the property that combining things yields things that can be combined again.
- Substitution model: a simple model of evaluation that replaces names with their values, valid when there is no assignment.
- Environment model: a model of evaluation using chains of frames that bind names to values, needed once assignment is allowed.
- Recursive process: a process that builds up deferred operations whose number grows with the input.
- Iterative process: a process whose state is held in a fixed number of variables at each step.
- Tail recursion: a self-call that is the last action of a procedure, which a proper implementation runs in constant space.
- Order of growth: a rough measure of how a process's time or space grows with input size.
- Data-directed programming: dispatching generic operations through a table indexed by operation and type.
- Message passing: representing data as procedures that respond to requests for operations.
- Assignment: changing the value associated with a name.
- Stream: a sequence whose later elements are computed only when needed, allowing infinite sequences.
- Delayed evaluation: postponing a computation until its result is required.
- Metacircular evaluator: an interpreter for a language written in that same language.
- Metalinguistic abstraction: solving problems by designing new languages suited to them.
- Nondeterministic evaluator: an evaluator that chooses among alternatives and backs up automatically on failure.
- Register machine: a simple model of a computer with registers, basic operations, a stack and a controller.
- Garbage collection: automatic reclamation of memory that is no longer reachable by the program.
- Compiler: a program that translates source code into lower-level instructions before it runs.
A note on this edition
This is a study edition written for this shelf in our own words. It describes and explains Structure and Interpretation of Computer Programs but does not reproduce it; the examples and analogies here are ours. The book itself is in copyright. The MIT Press has made the text of the second edition freely readable online, and printed copies are widely available in libraries and bookshops. It is best read in full, with an interpreter at hand and the exercises worked one by one.