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?