我是(Lisp)方案编程的新手,并且一直在学习本教程。在我使用字符串集之前一切都很顺利!
字符串设置!用于替换索引处的字符。我在下面做的一个例子:
Welcome to Racket v5.1.3.
> (define greeting "Hello; Hello!")
> (string-set! greeting 1 #\a)
string-set!: expects type <mutable string> as 1st argument, given: "Hello; Hello!"; other arguments were: 1 #\a
=== context ===
/usr/share/racket/collects/racket/private/misc.rkt:85:7
> greeting
"Hello; Hello!"
>
执行时(string-set! greeting 1 #\a)
,应根据教程将第一个' e '替换为' a '。输出应该是:
> greeting
"Hallo; Hello!"
但相反,我得到了错误string-set!: expects type <mutable string> as 1st argument
。我做错了吗?