Leo Teng
Leo Teng

Reputation: 93

Racket Scheme: Include externel rkt file with dynamic file name

I want to load external rkt file in racket scheme from a parameter of a function. E.G.,

(define (test fileName)
   (include fileName)
)

However, I am getting error indicating that fileName is not a pathname string, file' form, orlib' form.

Is there a way to fix this or is there another better way to include a file from dynamic filename?

Upvotes: 3

Views: 469

Answers (1)

Sam Tobin-Hochstadt
Sam Tobin-Hochstadt

Reputation: 5053

The best way to do this is to make the external file a module, and use dynamic-require.

Upvotes: 3

Related Questions