DrRacket 中编写的代码与“R5RS”有什么区别?对比“#langracket”?
两种语言类型的编码语法或代码是否相同?
我用 #langracket 语言编写了一个程序,但我应该用“R5RS”类型来做。
Is there a difference between in syntax of coding or code will same in both language types?
I wrote a program in #lang racket language but I was supposed to do it in the "R5RS" type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短的答案是它取决于程序。
#lang球拍
和#lang r5rs
共享相同的基本语法,但较小的事物可能会在两者之间发生变化,例如 [可以代替(
在球拍中,但在R5RS中不在。smantics 或球拍和R5RS方案之间可能还有其他差异。这意味着,当作为球拍运行时,相同的程序可能会有所不同 计划程序。
程序或作为R5RS 案件。
The short answer is that it depends on the program.
#lang racket
and#lang r5rs
share the same basic syntax but smaller things may change between the two, e.g.[
can be used in place of(
in racket but not in r5rs.There may be other differences between the semantics or racket and r5rs scheme. This means that the same program may behave differently when running as a racket program or as a r5rs scheme program.
This is usually not the case because both racket and r5rs scheme share a lot of semantic but two different implementations of r5rs scheme are allowed to have different semantics in some special and agreed upon cases.
最明显的区别在于 Dr. Racket REPL。 Racket 中的规范列表是不可变的,而 R5RS 中的规范列表是可变的。 REPL 对不可变列表和可变列表的处理方式有所不同。
在#langracket中,Dr.Racket REPL 以这种方式响应(使用不可变列表):
在#lang r5rs中,Dr.Racket REPL 以这种方式响应(因为可变列表) REPL 以这种方式显示列表):
我相信这就是其 REPL 行为与更典型的方案不同的原因。典型的方案 REPL 是这样响应的(响应中不带引号):
有趣的是,使用
#lang r5rs
、display
和write
在 Dr.球拍以预期的方式:The most visible difference is in the Dr. Racket REPL. The canonical list in Racket is immutable, while the canonical list in R5RS is mutable. And the REPL treats immutable and mutable lists differently.
In
#lang racket
, the Dr. Racket REPL responds this way (with an immutable list):In
#lang r5rs
, the Dr. Racket REPL responds this way (because mutable lists are displayed by the REPL this way):I believe that is the reason for its different REPL behavior from more typical Schemes. Typical Scheme REPLs respond this way (without the quote in the response):
Interestingly, with
#lang r5rs
,display
andwrite
behave in Dr. Racket in the expected manner: