3 ms·
I think you are being misled by the seemingly simple headline "how would you write du...". The question was not straightforwardly practical but deep in the ter
by applicative 16y ago
I think you are being misled by the seemingly simple headline "how would you write du...". The question was not straightforwardly practical but deep in the territory of so-called 'recursion schemes:
The natural way to do this is to use an unfold to
generate a list or tree of all the files in the
directory tree, map over them to get the sizes,
and do a fold to get the total.
-- And similarly elsewhere, more explicitly, as he makes clear why he isn't interested in the 'obvious' solutions, e.g.:
Yep, this is a good practical approach if I just want
to "du". I'm looking specifically for the fold . map .
unfold approach ...
The interventions of doliorules and then winterkoninkje (whom you quote) were in fact the ones that spoke to his condition.