Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:38:30+00:00 2026-05-28T20:38:30+00:00

I’m trying to use drracket to work thru the exercises in How To Design

  • 0

I’m trying to use drracket to work thru the exercises in “How To
Design Programs 2nd Ed”.

A number of the exercises in this build up on the answers to previous
questions, so I would like to include the source files from the
answered questions so that I don’t have to copy and paste the the body
of the old answer each time.

My main question is: How do I do this?

I have looked thru the documentation and found a method called
include that seems to do what I want, but I cant work out how to use
it correctly.

eg – I have two files:

test.rkt – this compiles and runs fine and contains one function:

(define (test) 1)
(test)

newtest.rkt – I would like this file to to be able to use the function defined in test.rkt.

(require racket/include)
(include "test.rkt")

(define (newtest)  (* test 2))

When I try to compile this I get the following error:

module: this function is not defined

(Not very informative, but that’s all the information I’m given…)

How do I get this first file to include without getting this error? Is include
even the right function for this, or is my approach completely wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:38:31+00:00Added an answer on May 28, 2026 at 8:38 pm

    The include 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 "test.rkt" in a regular text editor. The #reader.... bit is what generates the module. But when that gets included into the other file, it doesn’t make sense. Thus the error complaining about module.

    Unfortunately, as far as I can tell, the HtDP languages still don’t have provide, which is what you need to make this work right.

    If you really want to get this working, here’s a way to hack around it:

    Create a new file called "provide.rkt" 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 "provide.rkt":

    #lang racket
    (provide provide)
    

    (That declares a module using the full Racket language that provides only the built-in special form provide.)

    Add the following lines to your "test.rkt" program. (Make sure DrRacket’s Language is set back to “Beginning Student” or whichever teaching language you’re using for this.)

    (require "provide.rkt")
    (provide test)
    

    Now "test.rkt" is a module that exports your test function. (It was always a module, it just didn’t have any exports before, so it wasn’t very useful.)

    Add the following lines to your "newtest.rkt" program:

    (require "test.rkt")
    

    That imports everything provided by "test.rkt": currently just test, but you can add other things to, you just have to provide them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.