I would try make-wrapping-module-begin too. Basically, it wraps all module-level forms that "calculates something" with the syntax object you gave it. For example, the following program
;; some-language.rkt #lang racket (provide (except-out (all-from-out racket) #%module-begin) (rename-out [mb-module-begin #%module-begin])) (require "some-module-that-provides-add-content.rkt" syntax/wrap-modbeg (for-syntax syntax/parse)) (define-syntax acc-module-begin (make-wrapping-module-begin #'add-content!)) (define-syntax mb-module-begin (syntax-parser [(_ module-level-expr:expr ...) #'(acc-module-begin module-level-expr ...)])) will be able to transform the code #lang s-exp "some-language.rkt" "abcdefg\n" (define y 5) "hijk\n" y into something like: #lang s-exp "some-language.rkt" (add-content! "abcdefg\n") (define y 5) (add-content! "hijk\n") (add-content! y) If add-content! saves all values in a global variable, the whole content can be extracted later (after module-level-expr ...). On Fri, Aug 17, 2018 at 2:23 PM, Vityou <zlee...@gmail.com> wrote: > Thanks for the example. I'm still somewhat new to racket, so I may have to > study the example for a while before I understand it. The > `make-wrapping-module-begin` that Alexis mentioned seems to do something > similar, so I may end up using that due to it's simplicity. > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.