Ludovic Courtès <l...@gnu.org> skribis:

> What about writing it like this:
>
>   (define (first-subdirectory directory)
>     "Return the file name of the first sub-directory of DIRECTORY."
>     (match (scandir directory
>                     (lambda (file)
>                       (and (not (member file '("." "..")))
>                            (file-is-directory? (string-append directory "/"
>                                                               file)))))
>       ((first . _) first)))
>
> The result will be deterministic since ‘scandir’ sorts entries.

Pushed as cfd4e4d06e3cda0f3eed8d6b9277ce53e55404b8 on ‘core-updates’.

Thanks,
Ludo’.



Reply via email to