Section~#secmemory#45074> motivated the idea of functions with memory;
section~#secsetbang#45075> explained how variable definitions and
<#68160#><#45076#>set!<#45076#><#68160#> can together achieve the effect of memory. It is now time
to discuss the design of programs with memory.
Designing functions with memory requires three important steps:
- We must determine that a program requires memory.
- We must identify the data that goes into the memory.
- We must understand which of the services are supposed to modify the
memory and which are to use the memory.
The need for the first step is obvious. Once we have know that a program
requires memory, we must conduct a data analysis for the program's
memory. That is, we must figure out what kind of data the programs puts
into memory and retrieves from there. Finally, we must carefully design
those functions for the program that change the memory. The others are
those that use the variables (without modification); they are typically
designed with one of the receipes we have already discussed.