Hacker News new | past | comments | ask | show | jobs | submit login
Structure and Interpretation of Computer Programs (SICP) Book (mitpress.mit.edu)
195 points by peter_d_sherman 6 months ago | hide | past | favorite | 75 comments

My girlfriend has told me a couple times she wants to learn to program but this is the only intro book I own. I feel bad giving it to her because it just beats you with recursion right from the beginning (that isn’t to say it’s bad, I love it, that’s why I own a copy. I just feel like you’ll appreciate it most if you already know a little of some non functional language.) On the other hand she took it with us on a picnic the other day and didn’t seem to mind, in fact the simplicity of scheme’s syntax actually seemed to help a lot (she tried python once and there were too many different syntactic structures, but that was me giving her a tutorial rather than going through a book so maybe I’m just a bad teacher.)

Does anyone have any suggestions?

I have high hopes for this Fall's MIT course in Computational Thinking [1]. While it was discussed here on HN, I don't think it got all the attention it deserves.

I think this course will end up to be the start of a revolution in online teaching. We've had MOOCs and OCW, and other courses online for a while now, but this is a whole different level. They enlisted 3Blue1Brown (Grant Sanderson) to lecture. Arguably, he is head and shoulders above everyone else when it comes to mathematical animations and intuitive explanations. Coupling the pedagogical genius of this guy with the research genius of Alan Edelman, and with the expressivity of the new language Julia (which might beat Scheme in the end), this is a recipe for absolute success.

Oh, and the main lectures are live and you can ask questions (and if your question is good, you receive the answer right away).

Run, do not walk, to enlist in this course.

[1] https://mitmath.github.io/18S191

I wonder if Grant feels lucky to get to work with MIT. MIT is obviously an amazing school but I really feel like they are the lucky ones. Even before covid, I thought that his work was light-years ahead of most math education. Now that everyone is scrambling to move online I'm sure he's even further ahead.

How to Design Programs (https://htdp.org/) is fantastic, I believe it's based off SICP but I found it a little more accessible. It leads into recursion pretty well and intuitively, probably the favorite programming book I've read.

If she is mathematically minded I would not be afraid of letting her learn with it (note that the corresponding course taught by the original authors is also available in video somewhere on the web and that you can use the SICP dialect with Racket).

Having discovered programming in a functional language (Ocaml) I found that it was people with prior experience in other languages (such as Python) who had the most trouble getting confortable with recurcion.

I’d recommend going through Brian Harvey’s video series while doing the book. Watch the video that covers the topic and then go through the section in the book. They also have recommended problems to do in the book. You don’t have to approach the book as a completionist who needs to complete every problem, etc. especially if you’re starting out. You can always revisit the book later with more experience, but the insights it can give you are invaluable . https://www.youtube.com/playlist?list=PLhMnuBfGeCDNgVzLPxF9o...

SICP was used as the reference book for the introductory course on programming on my degree. People with prior experience had the most trouble with recursion. Students with no programming experience whatsoever grasped the concept pretty easily.

I would try it out. It might need some analytically wired thought process, but again that is true for any kind of programming paradigm.

Let's not forget to draw a distinction between programming and computer science...

SICP was created to be an introductory computer science textbook back in the day when anybody who actually enrolled in a computer science course could reasonably be expected to be an absolute nerd. It's a book for teaching computer science to people who already have some amount of programming aptitude. It is not a book that tries to teach programming, to hand-hold students through learning practical applications. Yes, it's been shoehorned into many programming courses, but that's not the book's purpose.

HtDP is much better for teaching programming - it's a book that follows many of SICP's ideas, but doesn't presume any relevant experience on the part of the student. It's still not an ideal book for teaching practical programming to a student who doesn't care about any of the CS theory, though.

It depends on the person. How they like to think. I promise!

Whether we look at it as programming or computer science, it's abstract enough that it's highly personal and each person has their own idiosyncratic style of learning.

I did and would benefit much more from a book like SICP than books that are written into a more specific purpose.

Recursion seems to be one of those inflection points that some people just can't get past.

What I personally see in academic setting is that when recursion is taught, it's taught using examples where you would not want to use recursion.

It's easy to understand why recursion is useful when you are tasked with traversing a file system. It's not when the first example you are given is calculating Fibonacci sequence.

I like the way SICP handles this, actually. They state clearly (in the text, haven't watched the videos) that the naive recursive form for Fibonacci is only illustrative, then they proceed to provide the iterative form. Following that they have this paragraph:

> One should not conclude from this that tree-recursive processes are useless. When we consider processes that operate on hierarchically structured data rather than numbers, we will find that tree recursion is a natural and powerful tool. But even in numerical operations, tree-recursive processes can be useful in helping us to understand and design programs. For instance, although the first fib procedure is much less efficient than the second one, it is more straightforward, being little more than a translation into Lisp of the definition of the Fibonacci sequence. To formulate the iterative algorithm required noticing that the computation could be recast as an iteration with three state variables.

Hopefully a professor in a course would make similar statements (I know mine did, repeatedly). And, at least in my early programming courses, we quickly (within a week or two) went on to those other problems where recursion was a natural and useful solution. The professors [0] introduced problems where recursion was either necessary (using for/while loops would be a non-trivial transformation with no performance gain) or, like naive Fibonacci, natural expressions of the problem.

[0] I transferred universities, not all courses lined up so I got to see the second school's introduction to this topic even though I was past that point academically. I was an unpaid TA (technically I guess I was paying to be the TA).

This is like complaining that when piano teachers teach students how to hold their hands they teach it with scales where it doesn't really matter. The importance of hand position is obvious when you are tasked with playing chords in a real song.

The very first exercise should be as simple as possible. Explicitly because you're introducing a new concept and so want as little else in the way as you can arrange.

I disagree to an extent. Sure file system traversal is great motivating example (or any tree traversal example for that matter).

However, the Fibonacci sequence provides good end to end example of recursion, then tail recursion/dynamic programming.

A great way to let someone understand recursion is to let them learn how the principle of mathematical induction works. It gets rid of all the noise related to the programming language.

That's because in order to understand recursion you must first understand recursion.

I thought it was a dark art before I worked my way through a few chapters of the Little Lisper. Then the spell was broken

It's "introductory" for MIT students who have a background in engineering, math, or physics, not average people off the street.

Recursion is hard for students to grasp when taught in math contexts as well, so I don't think this is a matter of prior CS teaching biasing them one way.

Python for the Absolute Beginner was very easy. Each chapter introduced a new concept (Ex: strings, variables, lists, iteration, branching, dictionaries, functions, file I/O, classes...etc) with a little text game (Ex: hangman). The writing is laid back and interesting. Once I read this I was able to start writing my own code with a little help using StackOverflow and it's been terrific for my career. There is no mathematical or computer science jargon to weigh you down. That can always come later. At this point programming is hard enough, but this book shows you all the building blocks and gives you some practice assembling things together.

The Little Schemer by Friedman is a good choice.


When SICP was written the majority of the freshman who took that course had never touched a computer before they took that class.

This can be interpreted two ways:

1. It really is an introductory text and, as the book says, recursion is a simple, powerful, familiar idea.

2. Times have changed.

I’m partial to interpretation #1

It depends on 'why' she wants to learn programming. What does she like and wants to be able to do herself? Like shiny gui, or webpages or own robot controller?

I happen to think SICP is a pretty good start for the reason you mention, the simplicity of syntax, in my experience it only gets hairy in the end when you start implement OOP on top of it.

Another good easy to learn as a first language in my experience is Rebol because it allows you to do stuff you ( meaning a person who uses a computer) might want to do quickly (send emails, scrape websites)

Of course another benefit of SICP is that it is written by people who are probably better writers about languages than most of the programmers hired to write programming books and articles.

> it just beats you with recursion right from the beginning

I'm not disagreeing with you as I write this, more pontificating on teaching styles... we all know recursion can get tricky / be hard to understand in the context of a programming language, but sometimes it's all in the presentation... if we tell the student right up front "hey, this is how we do this, no big deal right?" then perhaps they don't put up their natural defenses and make it into a harder concept than it really is?

I'd also recommend "How to Design Programs", newest version is here: https://htdp.org/2020-8-1/Book/index.html. It's a much more accessible version of SICP.

I've heard good things about Code by Petzold although I haven't read it myself.


I've read it; it's a phenomenal book to understand more about how computers work on a hardware and conceptual level, but it doesn't really teach programming. Still strongly recommended.

I suggest you trust the authors to know best when it comes to teaching programming. Sounds like you're worried it will be too hard for her. It might be. Non-programmers have lots of romantic ideas about what they think programming is. But the only way to know whether someone possesses any talent in it is to try it. I tried to teach one of my ex-girlfriends to program but I could tell before long that she didn't have the gift so encouraged her to do other things.

Automate the boring stuff with Python maybe. It quickly gives you useful results. But of course it’ll only get your feet wet, it’s nowhere near as formal and thorough as SICP.

I'm sure she'll be fine. She sounds like she already is. She might exceed you. People can teach themselves right?

This book looks good but I don't think I should start reading it, because I get the feeling it's going to let me want to create my own "powerful programming language" and be led down that (long, probably dark) rabbit hole.

To understand recursion first understand recursion on a recursive data structure (list, tree). It is very natural and there are loads of interesting algorithms. General recursion is more difficult to understand algorithmically so leave it for later.

If videos are okay i would recommend the course on edx.org taught by Gregor Kiczales "How to code: Simple Data" and the successor about complex data. They are based on the book "How to design Programs" also from MIT IIRC.

<3 A Type of Programming: http://atypeofprogramming.com/ <3

HTDP is a more gentler introduction to programming.

This is one of the best books I have read on any topic. It's marvelous. If you want to run the code you can use Racket with the SICP language mode: https://docs.racket-lang.org/sicp-manual/index.html#%28part....

There's an interactive version as well: https://xuanji.appspot.com/isicp/

I was fortunate enough to encounter this book in a first-year programming course (Informatik, RWTH Aachen). The years before, they had used Modula-3 and in the years afterwards they switched to Java.

While it certainly changed my life - first encounter with functional programming - and I will always appreciate it, it is now 23 years later and I think it is time to acknowledge some shortcomings.

The thing that comes to my mind first is the lack of any discussion pertaining to coding against interfaces, with components (and their interfaces) evolving over time.

Data abstraction gets discussed very early on, but the evolution of interfaces, its twin sister topic, does not get much air time. This is a pity since the goal of data abstraction (avoiding making assumptions on data representation) is pretty much the same, being able to change things later when the need arises.

There is an exercise - 2.29 where you implement a tree-like structure of objects.

Part d of the question is:

" d. Suppose we change the representation of mobiles so that the constructors are

(define (make-mobile left right) (cons left right)) (define (make-branch length structure) (cons length structure))

How much do you need to change your programs to convert to the new representation? "

It may not be discussed in depth - I suspect they decided it was out of scope for the book, but they were definitely thinking about it...

Actually I think interfaces are discussed in Chapter 2, when you write "packages".

What bugged me more about that part is, that no code is given for running solutions to the exercises. I know there is a "framework" online somewhere, written in Racket, but it would be nice to have it in Scheme instead, in a very large part portable to many Scheme dialects.

If you decide to work through this book, I suggest to follow along this YT channel [1] as the owner of this channel is going through each chapter (and exercises) roughly every week right now (currently at chapter 4.1)

[1] https://www.youtube.com/watch?v=oA-FdE3KV88&list=PLVFrD1dmDd...

I finally read SICP half way through my career, but at that point it was too much old news to keep me interested, even if I recognized that it was a really well written book. So I actually stopped half way.

Does anyone know of a good summary or alternate text of all the knowledge in it?

My advice: Take SICP, and use it to teach someone else.

There is a certain depth that comes from teaching which you won't get any other way. You'll discover things you never thought about.

That's even true if you're teaching little kids arithmetic, if you do it well. You'll discover structures in the multiplication table you've never thought about.

Look at SICP not just for the CS component but for the pedagogical and writing components too. Analyzing this sort of book is one of the best ways to become a great teacher and writer.

You can read the lambda papers, they very condensed and technical compared to SICP. Also, they cover more advanced topics.

Edit: Link - https://en.wikisource.org/wiki/Lambda_Papers

This might be interesting as well: https://en.wikipedia.org/wiki/How_to_Design_Programs

There is at least http://www.sicpdistilled.com

That's gooood. Thanks!

"Concepts, Techniques, and Models of Computer Programming" is considered the natural successor to SICP. I haven't tried it, but apparently it's a good deal harder.

> too much old news to keep me interested

Did you try working the exercises? That was what kept me engaged with it.

There is an adaptation of SICP written in JavaScript. It is used by the University of Singapore and it's frequently updated. It tries it best to retain the essence of the original but gives a new flavor to it by applying the concepts in ES6.

Here is the link to the book: https://source-academy.github.io/sicp/

I make a point of re-reading Alan Perlis' preface from time to time:


Fun is important, and it seems all too easy to lose sight of that.

If i had to retain one thing from SICP, it would be this from the preface of the first edition:

First, we want to establish the idea that a computer language is not just a way of getting a computer to perform operations but rather that it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute.

code_report has been doing a great series of SICP videos recently https://www.youtube.com/watch?v=oA-FdE3KV88&list=PLVFrD1dmDd...

An easy to remember short URL if you need a PDF copy: https://git.io/sicp.pdf

IMO opinion this is the best version around: http://sarabander.github.io/sicp/

Also available as epub: https://github.com/sarabander/sicp

Do you have a working link for the epub version? The one on the page downloads a text file with three lines, with tags version, oid and size.

After some clicking around:


Second post on the page.

That HTML port is more complete than the one below, but this link has a built-in interpreter for playing around with code (without having to install some heavyweight runtime):


If you only ever buy/read two computer science books, get your hands on Abelson/Sussman's SICP and Knuth's TAOCP.

I could program before studying at uni, but thanks to our two-term course Algortmics I+II at FAU Erlangen (part I based on SICP), it seems a fog that I wasn't even aware of cleared.

TAOCP is nearly ten thousand pages spread over four volumes! That's not one book.

Have you read TAOCP?

I'm not GP, but I read and worked through almost the entirety of Volume 1. I found it both approachable and enlightening. I have read (but not worked through) large chunks of Volumes 2 and 3, I have not purchased a copy of Volume 4 yet.

Volume 1 really works well if you also work through Concrete Mathematics (my professor and I started on Volume 1, diverted to CM, then back to Volume 1). CM provides enough additional math to get through chapter 1, where I was having a bit of trouble on some of the math heavy portions.

I want to work through the book I can barely find time for that.

Fair enough, I don't have the time anymore myself. College and my mid-20s were the best time to do all of those things. Now that I'm approaching 40 I have very little time and have to be more selective in how much time I dedicate to these kinds of resources.

I actually started working through TAOCP one summer during a very boring sys admin job. I couldn't actually change the system to improve it, just complete whatever tasks were given to me and help customers. Maybe 1-3 hours a day of actual work effort. And in the pre-smart phone days, a book was easy to work through without distractions until the next ring of a phone call or ding of an email.

It's pretty annoying that the location of the "next" link keeps shifting as I turn the pages. It seems like it would be better if the navigation links were at a fixed position so you could easily flip forward or backwards several pages.

The very first Computer Science course in college. It was all downhill from there.

The thing that I always find interesting is a bunch of fearless 18 year olds just throw themselves at SICP. Feel the pain and some survive.

Then some Ruby/PHP/JS developers who have 5-10 years of coding experience tip their head at the book and say it's too hard or "only for senior people".

Unlike the gym, with intellectual pursuits the only thing you can injure when you fail is your ego. If you learn to let go you will realise how much you hamstring yourself with your own preconceptions in life.

"intellectual pursuits the only thing you can injure when you fail is your ego" well, construction, mechanical and electeical engineering might have a different opinion.

Sorry to clarify - the act of studying knowledge from a book, carries limited risk. What you do with that knowledge or practical learnings are out of scope here. :)

Well, you can also learn things the wrong way and this can give you the impression you are an expert while the opposite is true.

I keep meaning to work through this book, and keep getting distracted by other things. Maybe this will be the time I actually manage it! Probably not though...


">Structure and Interpretation of Computer Programs (SICP) is a computer science textbook by Massachusetts Institute of Technology professors Harold Abelson and Gerald Jay Sussman with Julie Sussman. It is known as the Wizard Book in hacker culture.[1][2] It teaches fundamental principles of computer programming, including recursion, abstraction, modularity, and programming language design and implementation.

The MIT Press published the first edition in 1985, and the second edition in 1996. It was formerly used as the textbook for MIT's introductory course in electrical engineering and computer science. SICP focuses on discovering general patterns for solving specific problems, and building software systems that make use of those patterns.[3]

The book describes computer science concepts using Scheme, a dialect of Lisp. It also uses a virtual register machine and assembler to implement Lisp interpreters and compilers.


Several fictional characters appear in the book:

Alyssa P. Hacker, a Lisp hacker

Ben Bitdiddle, a hardware expert

Cy D. Fect, a "reformed C programmer"

Eva Lu Ator, an evaluator

Lem E. Tweakit, an irate user

Louis Reasoner, a loose reasoner


The book was used as the textbook for MIT's former introductory programming course, 6.001.[5] That course was replaced by 6.0001,[6] which uses Python.[7] Other schools also made use of the book as a course textbook.[8] It is used as the textbook for MIT's Large Scale Symbolic Systems class, 6.945.[9]


Byte recommended SICP "for professional programmers who are really interested in their profession". The magazine said that the book was not easy to read, but that it would expose experienced programmers to both old and new topics.[10]


SICP has been influential in computer science education, and several later books have been inspired by its style."

> Alyssa P. Hacker, a Lisp hacker

I always thought "Alice P. Hacker" would be much better

Witty Response: She's a Lisp hacker AND a SAP programmer(!)(https://en.wikipedia.org/wiki/SAP) -- that's why her name is "Alys-saP." and not "Alice P."! <g>

Applications are open for YC Summer 2021

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact