Arthas Dark
Arthas Dark

Reputation: 21

about racket : #lang not enabled

I've got to learn how-to-design-program for a while.But once I started to use my Emacs to learn htdp, I met some problem. THE PROBLEM IS THAT: I typed #lang racket , but it just show:

  > stdin::7: read: #lang not enabled in the current context
  context...:
   /usr/share/racket/collects/racket/private/misc.rkt:87:7
  > racket: undefined;
  cannot reference undefined identifier
  context...:
   /usr/share/racket/collects/racket/private/misc.rkt:87:7

And I use 'require' to load path.

 stdin::30: cannot open module file
  module path: #<path:/Desktop/htdp/convert.rkt>
  path: /Desktop/htdp/convert.rkt
  system error: No such file or directory; errno=2
  context...:
   standard-module-name-resolver
   /usr/share/racket/collects/racket/private/misc.rkt:87:7

Also it can not work.

Can you help me to solve it? P.S my system is Fedora20.

Upvotes: 2

Views: 5943

Answers (2)

yanyingwang
yanyingwang

Reputation: 137

from the link https://docs.racket-lang.org/guide/Module_Syntax.html#%28part._hash-lang%29

it says:

The #lang at the start of a module file begins a shorthand for a module form, much like ' is a shorthand for a quote form. Unlike ', the #lang shorthand does not work well in a REPL, in part because it must be terminated by an end-of-file, but also because the longhand expansion of #lang depends on the name of the enclosing file.

Upvotes: 0

ಠ_ಠ
ಠ_ಠ

Reputation: 3078

When you're running a racket script from the console, you shouldn't need to define the language on the first line. This flag

racket -I <language>

can be used to specify a language when running from the command line. #lang racket should be the default, so just remove the line and run your script from the command line using the racket command.

Upvotes: 3

Related Questions