2

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.

soegaard
  • 30,661
  • 4
  • 57
  • 106
Arthas Dark
  • 21
  • 1
  • 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 Sep 03 '14 at 08:24
  • If you are using `(require "/Desktop/htdp/convert.rkt")` it is likely that you really want `(require "/home//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 Sep 03 '14 at 13:14
  • I installed Racket from racket-lang.org , I use paredit as my Emacs mode. – Arthas Dark Sep 04 '14 at 00:40
  • 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 Sep 04 '14 at 00:42

2 Answers2

2

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.

ಠ_ಠ
  • 3,060
  • 28
  • 43
  • I'm not running my script from the console :( , I'm running my script from Emacs, I want to know whether the "#lang racket"have a influence about the code like (require "xxx"),the main problem i want to solve is that I cannot load the file :) – Arthas Dark Sep 04 '14 at 00:53
0

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.

yanyingwang
  • 117
  • 6