How to design co-programs
summary
Argues that program structure follows not only input but also output data structures, promoting structural corecursion (unfolds) alongside recursion; shows zip reduced from three cases to two by analyzing the output, and decomposes quicksort into build then flatten (grow a tree then flatten it), explaining deforestation that recovers the standard formulation. Uses Haskell notation, Maybe, lists and trees, hydromorphisms and metamorphisms as tools, and notes the approach works in eager languages too provided co-recursions terminate.
AI-written summary · about
chapters (16)
- 0:00Intro
- 1:18Protocol
- 2:15Where do programs come from?
- 5:19Program structure follows data structure
- 9:21But this is only half the story
- 12:19Mixed data: Enumerate the alternatives
- 17:13Sorting by structural corecursion
- 25:425. Generative recursion
- 26:19Ecamples of generative recursion
- 30:15Combining structural recursion and carecursion
- 37:28Separation of concerns
- 40:32A learning opportunity
- 43:38Laziness
- 46:00On Teaching HIDP
- 47:00Structured programming
- 48:39Conclusion
