When we conceived of scheme in the 1970’s, programming was a very different exercise than it is now. Then, what generaly happened was a programmer would think for a really long time, and then write just a little bit of code, and in practical terms, programming involved assembling many very small pieces into a larger whole that had aggregate (did he say ‘emergent’?) behaviour. It was a much simpler time.
Critically, this is the world for which scheme was originally designed. Building larger programs out of a group of very small, understandable pieces is what things like recursion and functional programming are built for.
The world isn’t like that anymore. At some point along the way (he may have referred to the 1990’s specifically), the systems that were being built and the libraries and components that one had available to build systems were so large, that it was impossible for any one programmer to be aware of all of the individual pieces, never mind understand them. For example, the engineer that designs a chip, which now have hundreds of pins generally doesn’t talk to the fellow who’s building a mobile phone user interface.
The fundamental difference is that programming today is all about doing science on the parts you have to work with. That means looking at reams and reams of man pages and determining that POSIX does this thing, but Windows does this other thing, and patching together the disparate parts to make a usable whole.
Beyond that, the world is messier in general. There’s massive amounts of data floating around, and the kinds of problems that we’re trying to solve are much sloppier, and the solutions a lot less discrete than they used to be.
Robotics is a primary example of the combination of these two factors. Robots are magnificently complicated and messy, with physical parts in the physical world. It doesn’t just move forward along the ground linearly and without interruption: the wheels will slip on the ground, the thing will get knocked over, etc.
This is a very different world, and we decided that we should adjust our curriculum to account for that. So, a committee (here, Prof. Sussman peaked his hands over his head, which I interpreted to indicated pointy-headedness) got together and decided that python was the most appropriate choice for future undergraduate education. Why did they choose python? Who knows, it’s probably because python has a good standard library for interacting with the robot.
We are not at that moment concerned with how the procedure computes its result, only with the fact that it computes the square. … … Thus, considering only the values they return, the following two procedures for squaring a number should be indistinguishable. Each takes a numerical argument and produces the square of that number as the value.25
(define (square x) (* x x))
(define (square x) (exp (double (log x))))
(define (double x) (+ x x))
So a procedure definition should be able to suppress detail. The users of the procedure may not have written the procedure themselves, but may have obtained it from another programmer as a black box. A user should not need to know how the procedure is implemented in order to use it.
A guess is improved by averaging it with the quotient of the radicand and the old guess:
(define (improve guess x) (average guess (/ x guess)))
(define (average x y) (/ (+ x y) 2))
We also have to say what we mean by ``good enough.'' The following will do for illustration, but it is not really a very good test. (See exercise 1.7.) The idea is to improve the answer until it is close enough so that its square differs from the radicand by less than a predetermined tolerance (here 0.001):22