I’ve just started reading Structure and Interpretation of Computer Programs, and have been struck by how they introduce a couple of rather advanced concepts in such a clear way, hardly even hinting at how tricky these concepts can be to understand, particularly in other programming languages.
The first thing that jumped out was in Exercise 1.4, where they use a conditional test to determine which procedure to apply to some arguments:
((if (> b 0) + -) a b)
Depending on the value of
b, the two operands are either added or subtracted. This is a powerful way to introduce functions as first-class citizens.
The second was how naturally recursion is introduced as a problem solving mechanism. In fact, the first time it’s used, I don’t think it’s even named! Recursion is a very natural approach to solving mathematical problems using computers, and coming from imperative languages like Java, seeing recursion used so simply in the very first chapter of the book was really refreshing.
A final thought - I think Scheme is perfect as a teaching language. As the authors say, the syntax is so simple that it just gets out of the way and allows a concise exposition of all the necessary concepts of programming and computation. I’m looking forward to working through the rest of the book.