Please read Chapter 16 of How to Design Programs (HtDP). Complete exercises 16.3.2-16.3.4 and the Challenge question.
Though we would love to see your response for the follow-up question for 16.3.2, we aren’t requiring you to.
There is a solution attached to 16.3.2. Though you can of course read it we suggest you don’t, at least not until you’ve completed the problem.
Before you start working, you should add dir.rkt as a Teachpack.
In the second part of exercise 16.3.3, the size of a directory is the sum of the sizes of its contents, the length of its files list, and the length of its dirs list. For example, in HtDP Figure 44, the size of the TS directory is 218, and the size of the Code directory is 12.
The Challenge question asks you to “Generalize the function [find] to return a list of paths if the file name occurs more than once. Each path should lead to a different occurrence, and there should be a path for each occurrence.” The find function you hand in should have type signature
find : directory symbol -> (listof path)
where a path is a list of symbols. Note: it should return empty if the file name does not occur (rather than false as stated under the challenge instructions), and a list containing a single path if the file name occurs only once.
Within a single directory, all the names must be unique.
The assignment talks about “symbols”, which you likely haven’t seen. Please use strings instead of symbols.
Make sure you’re in the Intermediate Student language. To change it, go to the Language menu and select Choose Language... .
Using the file navigator, go to your cs019 directory within your home directory. Make a new directory called filesystem. Put your solution, which should be named filesystem.rkt, inside that directory. Open the terminal and paste the following two commands (on separate lines, press enter after each):