link="#009900" vlink="#007700" alink="#cc0000"> Teachpacks for How to Design Programs


The teachpack provides two-structures and one operation:

  • (define-struct dir (names dirs files))
  • (define-struct file (name size content))
  • create-dir which consumes a directory path (a string) and produces a directory.
  • The teachpack relies on two data definitions:

  • A directory is (make-dir string[path] (listof directory) (listof file))
  • A file is (make-file string[file name])
  • Sample: Set teachpack to and execute. Then evaluate
    > (create-dir ".")
      (cons (make-fil 'ball1.gif 1289 empty)
            (cons (make-fil 'blueball.gif 205 empty)
                  (cons (make-fil 'greenbal.gif 204 empty)
                        (cons (make-fil 'redball.gif 203 empty)
                              (cons (make-fil 'ufo.gif 1044 empty)
                                    (cons (make-fil ' 5811 empty)

    Note: Softlinks are always treated as if they were empty files.