CS 2135 (A01) Homework 3: Complex Data Definitions

Due: January 31 (Thursday) at 11:59pm via turnin (assignment name hwk3).

Assignment Goals


The Assignment

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.

  1. Write three examples of data created with the filesystem data definition.

  2. Write the template for programs over filesystems.

  3. Write a program total-disk-usage that consumes a filesystem and returns the total size of all files in the filesystem.

  4. Write a program rename-directory that consumes a filesystem, an existing directory name, and new a directory name and returns a filesystem with the directory name changed. You may assume the existing directory name is only in the system once.

  5. Write a program find-files-by-content that consumes a filesystem and a value and returns a list of names of all files that have the given value as their content.

  6. 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.


What to Turn In

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.


Hints and Guidelines


Back to the Assignments page