Alex Rivera | Logout

Including an external file in racket

Asked 2011-01-26T20:05:30.140
20

I would like to include all the functions defined in a given racket file so that I get the same effect as if they were copied. Is it possible to do that?

Edit
Report

1 Answer

18

You can use include as follows:

Create a file called "foo.rkt" that looks like this:

(define x 1)
(define y 2)

Then in another file:

#lang racket
(require racket/include)
(include "foo.rkt")
(+ x y)

You should see the result 3.

You can see the documentation for include as well.

answered 2011-02-08T19:01:33.613

Your Answer