<div dir="ltr">What you want is `<a href="http://docs.racket-lang.org/syntax/module-helpers.html?q=with-module-reading#%28def._%28%28lib._syntax%2Fmodread..rkt%29._with-module-reading-parameterization%29%29" rel="noreferrer">with-module-reading-parameterization</a>`:<br><br>(<a href="http://docs.racket-lang.org/syntax/module-helpers.html?q=with-module-reading#%28def._%28%28lib._syntax%2Fmodread..rkt%29._with-module-reading-parameterization%29%29" rel="noreferrer" style="font-size:13.1999998092651px">with-module-reading-parameterization</a> (lambda () (read (open-input-port "my-file.rkt"))))<br><br><div class="gmail_quote">On Fri Feb 20 2015 at 12:43:15 AM Thomas Gilray <<a href="mailto:thomas.gilray@gmail.com">thomas.gilray@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying to figure out how to use read-syntax on a port for an entire .rkt file. I want to then call (expand ...) on this and get back a (begin ...) or (module ...) form for the entire file in fully expanded form. Right now I have three issues:</div><div><br></div><div>a) I have to skip over the #lang as this is not recognized by read-syntax itself</div><div><br></div><div>b) I've needed to call read-syntax repeatedly to consume the whole file and put each expression in a top-level begin (a pretty klugy workaround)</div><div><br></div><div>c) even then, calling expand will report an error that "define" is not itself defined. Maybe there is a version of read-syntax that will use read-language internally in the right way but I can't find it.</div><div><br></div><div>There is probably a way of doing all of this at once, and better, but I don't know what that would be. I feel read-language is needed, but I don't see how this would work together with read-syntax. </div><div><br></div><div>Any advice or pointers would be greatly appreciated!</div><div><br></div><div>--</div><div>Tom</div><div><br></div></div>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
</blockquote></div></div>