Read How to Design Programs Chapter 16
Complete exercises 16.3.2-16.3.4 and the Challenge question.
Clarifications:
Before you start working, download the dir.ss teachpack and install it. To do this, select "Add Teachpack..." from the Language menu, then click on "Add Teachpack to List..." and find dir.ss
in the filesystem. Please make sure to use our version of dir.ss
, as the one built in to DrScheme has a small bug.
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
dir symbol → (list-of path)
, where a path is a list of symbols
as specified. It should return empty
if the file name does not occur,
and a list containing a single path if the file name occurs only once.
filesystem.ss
, containing your implementations of the
functions described in these exercises. Only turn in the final version of each function.