Re: Outstanding issue: directory-files in the context of huge directories
Lassi Kortela 04 Sep 2019 11:46 UTC
> One unanswered question from a few weeks ago was if we should provide a
> facility on top of open/read/close-directory that deals with very large
> directories more gracefully than directory-files, which just returns a
> list. If so, lots of good examples were referred to, and this snippet
> might be the best point we got to while discussing it:
In the current draft, there's a "read-directory" procedure which does
this really nicely. It easily supports generator-style and fold-style
helper procedures, as well as directory ports (i.e. open-directory
returns a special kind of port as in Gambit). I'm really happy that
something so simple and adaptable was found.
>> +1 for directory-fold, but -1 for returning an arbitrary number of
>> results, which just complicates matters for the users. You could
>> implement directory-fold on top of a read-many-entries call in C and
>> then do the conversion en masse, though.