Documentation of my journey through How to Design Programs, Second Edition. A great book about structured approach to program design.
The book emphasizes a structured approach towards writing programs. It's a great alternative to the usual ad-hoc style seen in many places, this quote illustrates this really well:
All this sounds rather complex, and you might wonder why we don’t just muddle our way through, experimenting here and there, leaving well enough alone when the results look decent. This approach to programming, often dubbed “garage programming,” is common and succeeds on many occasions; sometimes it is the launching pad for a start-up company. Nevertheless, the start-up cannot sell the results of the “garage effort” because only the original programmers and their friends can use them. source
- Create a signature, a purpose statement and a stub of a function
- Write a function's template
- Write examples as test cases
- Code the body of the function
- Debug and refine
It's a structured version of a TDD.
- add notes about natural, structural and generative recursion
- add notes about accumulators
- complete the missing exercises from Intermezzo 4: The Nature of Numbers
- finish 449, write a helper function
- refactor 457 to something more readable and elegant
- finish 460, 461
- refactor 476, make it more functional and readable
- finish 477
- add a note based on Concrete Time, Abstract Time
- describe "order of n steps” phrase
- describe "abstract running time"
- note that we measure the performance of a program by looking at the number of recursive calls its making
- add missing exercises from Intermezzo 5: The Cost of Computation
- finish 492
- finish 498
- finish 524
- finish 526
- finish 528
-
refactor 469 to fold -
edit, commit and push exercises from chapters 02 and 03
Special thanks to bgusach/exercises-htdp2e for publishing the journey through the book. It helped when I got stuck on some exercises.