Directory listings, continued Lassi Kortela 10 Dec 2019 21:19 UTC

Did our last discussion of directory listings reach a conclusion? The
current draft has three different facilities for the same job:

1. (directory-files [dir [dotfiles?]]) → string list

2. (make-directory-files-generator dir [dotfiles?]) → generator

3. (open-directory dir [dot-files?]) → directory-object
    (read-directory directory-object) → string or eof-object
    (close-directory directory-object)

The fourth possibility we discussed was a fold procedure.

Presumably the generator is a wrapper that first opens the directory;
then returns the next read-directory result on each call; and finally
closes the directory when read returns no more entries. Given that,
isn't it essentially a simpler but equally powerful interface as
open/read/write and we could just provide the generator?