gpt4 book ai didi

scheme - 为 Dr.Scheme 寻找 SimplyScheme 成语

转载 作者:行者123 更新时间:2023-12-01 09:14:40 24 4
gpt4 key购买 nike

我正在使用 Ableson/Sussman 完成 SICP讲座和伯克利 61A 讲座,这更多是我的速度。我想做一些伯克利的作业,但需要句子、butfirst、butlast 等的定义。看起来 Dr.Scheme 中曾经内置了一种简单的方案语言,但最新的 4.1.5 版本没有它。来自 Planet PLT我想我可以简单地添加 (require (planet "simply-scheme.ss"("dyoo"“简单方案”1 0))) 在我的定义窗口中。我明白了

require: PLaneT
could not find the requested package: Server had no matching package:
No package matched the specified criteria

我尝试从 here 获取 simple.scm 文件并将其粘贴到我的 Dr Scheme 定义窗口中,但它不起作用:

在高级学生模式下,我得到阅读:非法使用“.”

对于以下代码中的 (lambda (string .args) 行。

(define whoops
(let ((string? string?)
(string-append string-append)
(error error)
(cons cons)
(map map)
(apply apply))
(define (error-printform x)
(if (string? x)
(string-append "\"" x "\"")
x))
(lambda (string . args)
(apply error (cons string (map error-printform args))))))

在 R5RS 中我得到set!: 无法改变模块所需的标识符:数字->字符串(以下代码第7行)

(if (char=? #\+ (string-ref (number->string 1.0) 0))
(let ((old-ns number->string)
(char=? char=?)
(string-ref string-ref)
(substring substring)
(string-length string-length))
(set! number->string
(lambda args
(let ((result (apply old-ns args)))
(if (char=? #\+ (string-ref result 0))
(substring result 1 (string-length result))
result)))))
'no-problem)

最佳答案

除非您遵循专门为其设计的示例,否则高级学生永远不会真正为您工作。大多数书籍和示例都会假设 R5RS或类似的东西。我建议使用 Pretty Big 语言,因为它包括 R5RS、PLT require 语法以及其他一些内容。

为了使用 PLAneT 中的 SimplyScheme 包,您需要使用新的 require 语法(您可以在 package listing page 上找到它;看起来 docs for the package 尚未更新):

(require (planet dyoo/simply-scheme:1:2/simply-scheme))

关于scheme - 为 Dr.Scheme 寻找 SimplyScheme 成语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/739525/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com