[racket-dev] Speeding up `in-directory`

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Wed Sep 4 15:13:31 EDT 2013

On Wed, Sep 4, 2013 at 12:29 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>                                  (directory-list
>                                   (path->complete-path d init-dir)))])

I'm pretty sure this is wrong, but I'm not sure how to fix it.  In
particular, there's no reason that `init-dir` should have any relation
to any of the paths being generated, and so using it here is wrong.
You can break the code with

(for ([i (in-directory6 d)])
  (current-directory "/")
  (displayln i))

when run with a non-#f value of d.


Posted on the dev mailing list.