set-car!, set-cdr!无拘无束的球拍? [英] set-car!, set-cdr! unbound in racket?
问题描述
我只是想用 racket
中的 set-car!
和 set-cdr!
做非常简单的代码,但我得到了错误:expand: unbound identifier in module in: set-car!
和 expand: unbound identifier in module in: set-cdr!
I am just trying to do very simple code with set-car!
and set-cdr!
in racket
, but I got the error: expand: unbound identifier in module in: set-car!
and expand: unbound identifier in module in: set-cdr!
它们不是在球拍
中定义的吗?有人可以帮忙吗?
Aren't they defined in racket
? Could anyone help?
推荐答案
需要导入mutable-pairs-6
,像这样:
(require rnrs/mutable-pairs-6)
那些程序被移到不同的模块并重命名为mcons
、mcar
、mcdr
、set-mcar!
、set-mcdr!
、mlist
强调它们对可变数据进行操作,而不像它们的不可变对应物.
Those procedures were moved to a different module and renamed to mcons
, mcar
, mcdr
, set-mcar!
, set-mcdr!
, mlist
to emphasize that they operate on mutable data, unlike their immutable counterparts.
这篇关于set-car!, set-cdr!无拘无束的球拍?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!