<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 4, 2013 at 10:20 AM, Carl Eastlund <span dir="ltr"><<a href="mailto:cce@ccs.neu.edu" target="_blank">cce@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Yi,<br><br></div>Most #lang languages implicitly create a module from the contents of the file. #lang racket/load, on the other hand, runs the contents of the file as top-level terms outside of any module. The provide form is not legal at the top level, as it is meaningless -- there's no module to provide things from. You need to either switch back to #lang racket or remove the provide, depending on what you're trying to accomplish.<br>
</div></blockquote><div><br></div><div>Thanks for the answer, Karl. I also found the answer in the doc: <a href="http://docs.racket-lang.org/reference/load-lang.html">http://docs.racket-lang.org/reference/load-lang.html</a>. But very confusingly, the doc keeps saying "racket/load" module.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
</div><div class="gmail_extra"><br clear="all"><div>Carl Eastlund</div>
<br><br><div class="gmail_quote"><div><div class="h5">On Sun, Aug 4, 2013 at 4:12 AM, Yi Dai <span dir="ltr"><<a href="mailto:plmday@gmail.com" target="_blank">plmday@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">
<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>I have the following code in a file named `foo.rkt`:</div><div><br></div><div>```</div><div>#lang racket/load</div><div><br></div><div>(provide foo)</div><div><br></div><div>(define foo 'bar)</div><div>```</div>
<div>
<br></div><div>When trying to run the code, I got the following confusing error:</div><div><br></div><div>> `provide`: not at module level in: `(provide foo)`</div><div><br></div><div>What does this mean? Why `provide` is not at module level?</div>
<div>Use `#lang racket` instead does not pose this problem. I am</div></div><div style="font-family:arial,sans-serif;font-size:13px">confused. Any idea?</div><div style="font-family:arial,sans-serif;font-size:13px"><br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Yours truly,</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Yi</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/users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>