Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expected a module declaration, found something else?

Tags:

racket

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?

like image 247
QuillAndSaber Avatar asked Jun 21 '16 18:06

QuillAndSaber


Video Answer


1 Answers

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
like image 116
Joe Hansen Avatar answered Nov 14 '22 13:11

Joe Hansen