{ (define LIBNAME "Directories")
  (include "head.tinc") }

<p>The teachpack <code>dir.ss</code> provides two-structures and one
operation:
<menu>
  <li> <code>(define-struct dir (names dirs files))</code>

  <li> <code>(define-struct file (name size content))</code>

  <li> <code>{(idx create-dir)}</code> which consumes a directory path (a string)
       and produces a directory.
</menu>

<p>The teachpack relies on two data definitions:
<menu>
<li>
   A directory is
   <code>({(idx make-dir)} string[path] (listof directory) (listof file))</code>
<li>
   A file is <code>({(idx make-file)} string[file name])</code>
</menu>

Sample: Set teachpack to <code>dir.ss</code> and execute. Then evaluate
<pre>
> (create-dir ".")
(make-dir
  '|.|
  empty
  (cons (make-file 'ball1.gif 1289 empty)
        (cons (make-file 'blueball.gif 205 empty)
              (cons (make-file 'greenbal.gif 204 empty)
                    (cons (make-file 'redball.gif 203 empty)
                          (cons (make-file 'ufo.gif 1044 empty)
                                (cons (make-file 'gif-test.ss 5811 empty)
                                      empty)))))))
</pre>

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

{(include "foot.tinc")}
