【发布时间】:2009-04-11 04:36:55
【问题描述】:
我正在通过 SICP,同时使用 Ableson/Sussman 讲座和伯克利 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 中我得到 设置!:无法改变模块所需的标识符:数字->字符串 (以下代码第 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)
【问题讨论】: