【问题标题】:Geiser and Racket variable have been defined previously and cannot be redefinedGeiser 和 Racket 变量之前已定义,无法重新定义
【发布时间】:2015-04-08 07:45:58
【问题描述】:

我正在尝试在 emacs 中使用 geiser-mode 来运行球拍代码。 我已经能够安装 geiser-mode 并启动了球拍。

然而,当我两次运行定义时,我得到了以下错误。 这个名字是以前定义的,不能重新定义

这是一个简单的例子

 (define  a (* 1 4))
 a

运行两次

在调试器中

#a: this name was defined previously and cannot be re-defined
#in: a

【问题讨论】:

    标签: emacs racket geiser


    【解决方案1】:

    racket 似乎在文件和 REPL 中的行为不同。这个文件会报错:

    #lang racket
    
    (define a 5)
    (define a 6)
    

    而且这个 REPL 会话不会:

    > (define a 5)
    > a
    5
    > (define a 6)
    > a
    6
    

    这种行为是因为modules 的工作方式。在文件中工作时,有一个隐式模块。一旦在该模块中定义了符号a,就不能在该模块中定义另一个具有相同名称的符号。 REPL 只是expands forms 没有modules 的所有仪式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-06
      相关资源
      最近更新 更多