球拍:"string-ith" 在普通球拍中不工作

Racket: "string-ith" not working in normal Racket

我在 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 很难。谁能说明原因?

正如错误所说,只是这些语言没有预定义该过程。为方便起见,在 Beginning Student 中提供。

如果你想要它,那么使用像substring这样的现有程序来自己定义它。或者,如果您没有动力,this page 建议一种导入方法。