Given a directory structure in Scheme, print the sum of the file sizes.
A directory is a list of three items – “D”, a name and a list of contents.
There can only be one top-level directory, but there can be any number of nested subdirectories.
A file is a list of three items – “F”, a name and a file size.
Note – there is a Scheme built-in that you will need for this – the string compare function of eq?
> (eq? “A” “B”)
#
f> (eq? “C” “C”)
#t
Attached, please find an example directory structure and the function “skeleton” that I used for my solution.
You DO NOT HAVE TO use my function names or skeleton. Please be sure that ANY directory structure can be parsed with your code – DO NOT CODE TO THIS EXAMPLE. Your solution MUST BE recursive.
Download Dr Racket here: https://download.racket-lang.org/
Make sure that you set your language to R5RS.


0 comments