【问题标题】:Racket: "string-ith" not working in normal Racket球拍:“string-ith”在正常球拍中不起作用
【发布时间】:2020-12-20 04:46:54
【问题描述】:

我在Emacs 内的Geiser 环境中使用(string-ith "hello" 3)。显示错误

string-ith: undefined;
 cannot reference an identifier before its definition
  in module: top-level
  context...:
   eval-one-top
   /usr/share/racket/collects/racket/repl.rkt:11:26

我在 Dr.Racket IDE 中尝试过同样的事情。使用默认的#lang racket,同样报错,

> (string-ith "hello" 3)
. . string-ith: undefined;
 cannot reference an identifier before its definition
> 

但是将语言更改为beginning student,它可以正常工作。

> (string-ith "hello" 3)
"l"
> 

我试过(require racket/string),但没有用。

我发现使用racket 很困难。谁能解释一下原因?

【问题讨论】:

    标签: racket


    【解决方案1】:

    正如错误所说,只是这些语言没有预先定义该过程。为方便起见,它在初级学生中提供。

    如果需要,请使用现有过程(如 substring)自行定义。或者,如果您没有动力,this page 会建议一种导入方式。

    【讨论】:

    • 谢谢。我想正常的使用方式是string-ref函数。
    猜你喜欢
    • 1970-01-01
    • 2016-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多