[racket-dev] [plt] Push #27294: master branch updated
6 hours ago, mflatt at racket-lang.org wrote:
>
> 2ba615a Matthew Flatt <mflatt at racket-lang.org> 2013-08-10 19:12
> :
> | directory-list: always sort results
> |
> | Consistently sorting shouldn't cost much relative to the
> | cost of `directory-list' (except for the path->bytes conversion?),
> | and it makes directory traversals (including archive packaging)
> | more deterministic across runs and platforms.
> |
> | (Eli suggested this a long time ago.)
Yes, and as I said back then, with the new `path<?' there's probably
no reason to want unsorted results. [BTW, there's also only a minimal
cost for existing code that sorts the results (probably lots of
these), since `sort' does a check that the input is sorted -- however,
there is more significant cost since such code converts the paths to
strings/bytes and that's no longer needed...]
What I had in mind, due to the cost, was to have an argument that
specifies how things are sorted, so you could specify it as `values'.
Then I figured that it could also be used to do other kinds of sorts,
like put directories first, or even filter the results, which leads to
an argument that looks like:
(directory-list #:sort foo) => (foo (directory-list))
and that didn't seem right...
(As a sidenote, it would be nice to have some more standard globbing
support; I've written such things probably 2-3 times -- in the gui
racket-implemented file dialog, and in meta things like the bundle
script.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!