Contents
Page-10
Prev
Next
Page+10
Index
Findpath Representation
We will use a Cons representation in which a symbol or String is a file
or directory name and a list is a directory whose first element
is the directory name and whose rest is the contents.
findpath has two arguments:
- dirtree is a directory tree, a list of items:
(item1 ... itemn). Each itemi is:
- a subdirectory: a list (name item1 ... itemn)
(fall06 prog2.r prog1.r grades)
- a file name: prog2.r
- path is a list of names.
(/usr bill course cop3212 fall06 grades)
What findpath does is to look through its list to find some
item that matches the first name in path:
- If a subdirectory matches, go into that subdirectory.
- If a file matches, done: return that entry.
- If a file does not match, skip it; go to next entry.