For an operating systems class, you've been asked to implement a simple filesystem. The HTDP text provides three models for filesystems. Use Model 3, the one at the bottom of the page, for these exercises.
If you want to test your filesystems programs on a real filesystem (your own, for example), use the dir.ss library described in HTDP, exercise 16.3.1.
In these exercises, a "filesystem" is a directory (the root directory).
Write three examples of data created with the filesystem data definition.
Write the template for programs over filesystems.
Write a program empty-directories? that consumes a filesystem and returns a boolean indicating whether any directories in the file system have no files and no directories within them.
Write a program files-containing that consumes a
filesystem and a value (the contents of a file) and returns a list of
names of files that have the given value as the file contents. You
can compare random Scheme values for equality using the primitive
Write a program add-directory that consumes a filesystem, an existing directory name, and a new directory name and returns a filesystem. In the returned filesystem, the existing directory should contain all of its old directories plus a new (empty) directory with the given new directory name. All other files and directories should be the same between the input and returned filesystems.
Assume that the existing directory name is only in the system once.
Write a program find-file-path that consumes a filesystem and a filename and returns either the path (a list of directory names, in order from root to the one containing the file) to that filename or false if the filename is not in the filesystem.
Assume that the given file name is only in the system once.
Turn in a single file hwk3.ss (or hwk3.scm) containing all code and documentation for this assignment. Make sure that both students' names are in a comment at the top of the file.
Use map and filter whenever appropriate in your solutions.
Follow the templates!