Assignment 2

Assignment 2 - CS 136 Fall 2009 Kate Larson Assignment 2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 136 Fall 2009 Kate Larson Assignment 2 Due Tuesday, October 6, 2009, 10pm Language level : Module (full PLT Scheme). Mutation should not be used. To submit : ptree.ss , wc.ss , remove-remarks.ss , a2-script.txt 1. In Assignment 1, you were asked to implement a directory tree, where a directory could contain files and had at most two subdirectories. In this question you are asked to write a Scheme function, ptree , which consumes a directory tree and prints it, using the output functions presented in Module 02. You must use the following format. A directory name must always be preceeded by the symbol “/”. For example, a directory with name usr will be printed as /usr . The root of the directory tree will be printed on the first line, followed by its contents (first the files, then the first subdirectory and finally the second subdirectory) if any, all indented by one space. For example, if the directory tree is: ( define my-dir ( make-dir usr ( cons info.txt ( cons test.txt empty )) ( make-dir m1 empty ( make-dir b1 empty empty empty ) ( make-dir b2 ( cons file1.txt empty ) empty empty )) ( make-dir m2 empty empty ( make-dir b4 empty empty empty )))) It should be printed as follows: /usr info.txt
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2010 for the course CS 136 taught by Professor Becker during the Fall '08 term at Waterloo.

Page1 / 3

Assignment 2 - CS 136 Fall 2009 Kate Larson Assignment 2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online