Read How to Design Programs Chapter 16
Complete exercises 16.3.2-16.3.4 and the Challenge question.
Clarifications:
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 we know you may well read it, we highly suggest not to, at least until you've completed the problem.
Before you start working, you should add dir.ss
as a teachpack. (Language/Add 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))
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.
filesystem.rkt
, containing your implementations of the
functions described in these exercises. Only turn in the final version of each function.