[racket] define-runtime-path-list and find-files
On Mon, Jul 5, 2010 at 19:52, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> This seems to work for me:
>
> #lang racket
> (require racket/runtime-path (for-syntax racket/file))
> (define-runtime-path-list p (find-files (λ (x) (regexp-match "[.]tex$"
> x))))
>
> Probably you were missing the `for-syntax' require.
>
Ah, that is why! Thanks a lot!
Now another question:
I'm in fact using `find-files' inside a function, say `find-files-ex', that
is declared in the same file and used in the `define-runtime-path-list'
call.
The problem is that this function must be available both at compile time and
at runtime because of `define-runtime-path-list'.
I did not find anything that could do that as is, so I made this macro:
(define-syntax-rule (define-also-for-syntax head body ...)
(begin
(define-for-syntax head body ...)
(define head body ...)
))
to avoid duplication of the function code.
But I feel like it may not be the right thing to do. Am I missing something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100705/3478d86d/attachment.html>