Put directory-fold in the SRFI?
hga@xxxxxx 29 Jul 2019 18:45 UTC
> From: Lassi Kortela <xxxxxx@lassi.io>
> Date: Monday, July 29, 2019 12:51 PM
>> - A more general alternative would be a user-supplied filter procedure.
>> But that again gets into the territory of higher-level frameworks IMHO.
>> - Common Lisp used to have a 'with-directory-iterator' function in some
>> third-party library. So instead of returning a list of names, it
>> returned an iterable. For filtering, this could be the best option. A
>> directory _can_ in principle have 10k files or even more.
> In fact, Chibi has a directory-fold procedure:
> <https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/filesystem.scm#L23>.
> It might be worth having that in the SRFI. For some applications,
> you want to collect the filenames into a hashtable instead of a
> list, so a list is superfluous.
I certainly like directory-fold, it's simple and sweet, and I'm
exposing it in the Chibi Scheme SRFI implementation, along with a
procedure concept I picked up from scsh, delete-filesystem-object,
which does not raise an error if that object doesn't exist. Unlike
the 0.7 scsh version, it does error if it exists and can't delete it,
it and/or "create-file-thing" in the 0.7 version can cause a stack
consuming infinite loop....
> [...]
- Harold