13

I'm working on a Racket script (on a Linux machine) that requires the math/number-theory library. My entire script at the moment is thus:

#!/usr/bin/racket

(require math/number-theory)

Yes, it's literally just requiring the library.

When I try to run it, I get an error that reads "expected a `module' declaration found: something else".

However, when I actually start up Racket in the terminal like so:

/usr/bin/racket

and enter (require math/number-theory) in the command line, it treats it like it's totally valid.

What's going on here?

Asumu Takikawa
  • 8,447
  • 1
  • 28
  • 43
QuillAndSaber
  • 167
  • 1
  • 8

1 Answers1

22

Make sure the top of your racket files contains a #lang statement as well.

In other words, you need this at the top of the file:

#!/usr/bin/racket
#lang racket
Joseph Hansen
  • 12,665
  • 8
  • 50
  • 68