Some interesting caveats I discovered as I ran this code.
-x here should be - x (with a space).
I couldn’t figure this out.
If I write -1 in racket it’s okay.
If I write (-1) it gives me an error: application: not a procedure; expected a procedure that can be applied to arguments
Also super interested in thoughts on this one. I have it on my shelf and keep starting it then getting distracted with something else, been wanting to get into it properly for a long time
I just got back into reading it this month. I almost finished reading the first chapter during Covid, but just stopped for some reason.
Maybe we should start a book club for this? I wouldn’t mind leading one. This is quite a dense book, so I guess it would be pretty difficult to keep people engaged and reading.
You could either just go ahead and start a book-club thread for it in the Community > Journals & Book Clubs section and then say anyone can join in, or use this thread to see if anyone else might be interested in joining. Alternatively you could just start a journal and document your progress
I’ve just started one here. It’s only got my answers to the exercises. If I also made notes, I may never finish!
You can also find my old attempt here. I almost finished the 1st chapter (close to 50 exercises) in that one. Keep in mind that some links and things are broken in that one (plus the writing is not great).
I think I will start a book-club thread and see if anyone is interested when I get some time. Till then, we can gauge the interest here.
I don’t have high hopes though. It’s a tough book to read and it probably intimidates many potential readers away. The vast majority of people who do start never finish. Plus the fact that it doesn’t teach you any technology that you can put on your CV doesn’t help.
For those who might not know, there’s a full course taught by the authors of SICP (Harold Abelson and Gerald Jay Sussman) that you can use to complement the book:
There’s also a JavaScript adaptation of SICP, published by MIT Press in 2022. You can read it for free here:
Just a heads-up: some people criticize the JavaScript version for using questionable coding practices, like overusing the ternary operator instead of standard if...else blocks. So the examples might not always reflect what you’d call “good code”.
If you’re looking for other solid introductions to computer science and programming, these books are often highly recommended:
Some folks even argue that DCIC is the best foundational CS book out there. I haven’t read any of them myself, so I can’t say for sure, but they’re worth looking into.
Personally, I strongly recommend that if someone wants to read SICP, they should read the original Scheme version. I doubt if the ideas in that book could be conveyed so freely without friction in JavaScript as it can in Scheme.
Thanks for sharing! I didn’t know of these books. Now I have 3 more books in my list to read. I guess I’ll start with HtDP - it seems a little lighter than the other two.
Looking through the contents, it seems to be pretty solid. I think shifting between Pyret and Python was also a good move. You address the practical concerns of learning Scheme without compromising on foundational theory.
I think shifting between Pyret and Python was also a good move.
Just to expand on what I said earlier, SICP was the textbook for MIT’s former introductory programming course, 6.001. That course was taught at MIT for over 20 years until it was replaced in 2008. Since then, the introductory programming courses have been taught in Python.
Here’s what Gerald Jay Sussman, one of the authors of SICP and a former 6.001 instructor, said about the book/course being replaced and the switch from Scheme to Python:
Costanza asked Sussman why MIT had switched away from Scheme for their introductory programming course, 6.001. This was a gem. He said that the reason that happened was because engineering in 1980 was not what it was in the mid-90s or in 2000. In 1980, good programmers spent a lot of time thinking, and then produced spare code that they thought should work. Code ran close to the metal, even Scheme — it was understandable all the way down. Like a resistor, where you could read the bands and know the power rating and the tolerance and the resistance and V=IR and that’s all there was to know. 6.001 had been conceived to teach engineers how to take small parts that they understood entirely and use simple techniques to compose them into larger things that do what you want.
But programming now isn’t so much like that, said Sussman. Nowadays you muck around with incomprehensible or nonexistent man pages for software you don’t know who wrote. You have to do basic science on your libraries to see how they work, trying out different inputs and seeing how the code reacts. This is a fundamentally different job, and it needed a different course.
So the good thing about the new 6.001 was that it was robot-centered — you had to program a little robot to move around. And robots are not like resistors, behaving according to ideal functions. Wheels slip, the environment changes, etc — you have to build in robustness to the system, in a different way than the one SICP discusses.
And why Python, then? Well, said Sussman, it probably just had a library already implemented for the robotics interface, that was all.
I read a print copy of SICP (2e) during Covid, up to the last section in chapter 4, where they would start implementing something like Prolog if I remember correctly. One day I’ll want to finish the book.
SICP was a great shift in gears on my journey to becoming polyglot, a great introduction to “lispy” thinking. I read it after diving deep into Python, but it still improved my understanding and appreciation of Python as a dynamic and well-designed language (if you focus on the parts that functional programmers like). And it laid the foundation for my learning of Clojure, which I highly appreciate.
For what it’s worth, I don’t see how the JavaScript version should use more if/else than ternary. The whole point in SICP and Scheme (and the lispy languages) is that most things should be expressions, not statements.
On the side note of HtDP, I tried the beginnings a couple of times, but can’t find patience for the dogmatic style of writing stuff down upfront before coding. Writing code is too intermingled with my thought process. (not vibe-coding, and not committing or opening a PR too quickly, but just seeing my thoughts in code on the screen and then moving them around)