Chapter 1 is over! 🙂
It was loads of fun at the end – higher-order functions that abstract so many tedious tasks, (like repetitive application of a function, for instance), which are later used to describe so naturally ideas from numerical analysis. To me, the first chapter shows that Scheme is little, but very powerful language, and you can do so much work only with simple procedures, because of Scheme’s treatment of procedures as „first-class citizens“. The last one means, that procedures can be named, passed as arguments to other procedures and returned as results from other procedures. (They may also be part of data structures, but we won’t see it until somewhere in Chapter 2).
A brief look through the things I found most interesting:
- „average-damping“ (ex. 1.36) is some kind of sorcery, that will speed up your searching for fixed-points of functions. Neat!
- There may be worse things then Ackerman’s function – I evaluated the expression
((double (double double) inc) 5)(ex. 1.41) by hand, because we did it this way back with my first SICP Study group. Now I feel more confident in my understanding of the applicative-order evaluation.
- „accumulate“ (ex. 1.32) is very useful abstraction – it goes beyond simple accumulation of numbers, and can be used for accumulation of other objects, like in my third solution of ex. 1.43 –
(define (repeated f n) (accumulate compose id (lambda (x) f) 1 inc n)), where
composeis from ex. 1.42, and
idis the „identity“ function (
id(x)=x). I found this both simple and cool. 🙂
But some unfinished exercises remain – we are still struggling with the time complexity of the procedures in ex. 1.14 and 1.20, I still haven’t managed to make sensible improvements to the ex. 1.23 and 1.28, and there are a few other obstacles left. At least for the first, I hope that we will come up with something at our next meeting.
I can’t wait to play with the data abstractions, that wait ahead!