Re: [racket] requiring a file in current-directory, if it exists

2014-10-25 Thread Gustavo Massaccesi
There is a lot of magic inside the require macro and require-transformers. I still don't understand all the details, but I hope I got most of them right. With some simplifications it's easier to understand. First, we create two dummy modules ;--- a.rkt --- #lang racket (provide a) (define a "A!")

Re: [racket] requiring a file in current-directory, if it exists

2014-10-24 Thread Matthew Butterick
This worked — for some reason, moving the '(file ...)' expression into the `with-syntax` expression made a difference. (define-syntax (overriding-require+provide-with-prefix stx) (syntax-case stx () [(_ main override out-prefix) (let ([path-to-override (path->string (build

[racket] requiring a file in current-directory, if it exists

2014-10-24 Thread Matthew Butterick
I know that a hard-coded absolute path can be used in `require`: (require (file "/path/to/directory/module.rkt" But how can a generated path be used? Like so: (require (file (path->string (build-path (current-directory) "module.rkt" In particular, I want to `require` the file if it exis