Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define-struct fileinfo (name format size path))
- ;; A FileInfo is a (make-fileinfo Str Sym Num Str)
- ;; requires:
- ;; name is a non-empty string
- ;; that contains only alphanumeric characters
- ;; format is one of 'doc, 'txt, 'rtf, 'zip,
- ;; 'raw, 'jpg, 'wav, 'mp3
- ;; size > 0, and represents the size of the file in kilobytes
- ;; path is a non-empty string that
- ;; starts with a / character and ends with an alphanumeric character
- ;; contains only / and alphanumeric characters
- ;; with at least one alphanumeric character
- ;; that appears between any two / characters
- ;; (representing the name of a folder)
- ;; A Directory is a (listof FileInfo)
- ;; requires:
- ;; the elements of the list represent information about
- ;; files contained in the Directory
- ;; all elements of the list have the same path
- ;; each element of the list is uniquely identified by
- ;; its name and format (i.e. its full name)
- (define (dir-size direct)
- (cond
- [(empty? direct) 0]
- [(+ (fileinfo-name])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement