Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <code>include</code> form isn't working because when the language is set to "Beginning Student" or one of the other teaching languages, DrRacket actually wraps your program in a module. You can see this if you open <code>"test.rkt"</code> in a regular text editor. The <code>#reader....</code> bit is what generates the module. But when that gets <code>included</code> into the other file, it doesn't make sense. Thus the error complaining about <code>module</code>.</p> <p>Unfortunately, as far as I can tell, the HtDP languages still don't have <code>provide</code>, which is what you need to make this work right.</p> <p>If you really want to get this working, here's a way to hack around it:</p> <p>Create a new file called <code>"provide.rkt"</code> in the same directory as your other files. While you're editing this file (and only this file), set the Language in DrRacket to "Determine language from source". Put the following two lines in <code>"provide.rkt"</code>:</p> <pre><code>#lang racket (provide provide) </code></pre> <p>(That declares a module using the full Racket language that provides only the built-in special form <code>provide</code>.)</p> <p>Add the following lines to your <code>"test.rkt"</code> program. (Make sure DrRacket's Language is set back to "Beginning Student" or whichever teaching language you're using for this.)</p> <pre><code>(require "provide.rkt") (provide test) </code></pre> <p>Now <code>"test.rkt"</code> is a module that exports your <code>test</code> function. (It was always a module, it just didn't have any exports before, so it wasn't very useful.)</p> <p>Add the following lines to your <code>"newtest.rkt"</code> program:</p> <pre><code>(require "test.rkt") </code></pre> <p>That imports everything provided by <code>"test.rkt"</code>: currently just <code>test</code>, but you can add other things to, you just have to <code>provide</code> them.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload