2
votes

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.

2
Which emacs mode are you using? Which version of Racket have you installed? (If possible use the version from download.racket-lang.org) - soegaard
If you are using (require "/Desktop/htdp/convert.rkt") it is likely that you really want (require "/home/<your-user-name>/Desktop/htdp/convert.rkt") or just (require "convert.rkt") if it is in the same directory as the file you are working on. - ben rudgers
I installed Racket from racket-lang.org , I use paredit as my Emacs mode. - Arthas Dark
yeah , I've tried (require “/home/....”) and (require "convert.rkt") but still it cannot work. just told me that the directory is wrong. - Arthas Dark

2 Answers

2
votes

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.

0
votes

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.