我正在使用Ableson/Sussman的演讲和伯克利61A讲座,这是我的速度要高得多的。我想做一些伯克利的作业,但需要句子的定义,butfirst,butlast等。看起来曾经有一种简单的方案语言内置于博士中。方案,但最新版本 4.1.5 没有它。从 PLT星球我以为我可以在我的定义窗口中简单地添加(“ simply-scheme.ss”(“ simply-scheme.ss”(“ dyoo”“ simply-scheme” 1 0)))。我明白了

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

我尝试从以下位置获取 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)
有帮助吗?

解决方案

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

为了使用 PLAneT 中的 SimplyScheme 包,您将需要使用新的 require 语法(您可以在 包列表页面;它看起来像 包的文档 尚未更新):

(require (planet dyoo/simply-scheme:1:2/simply-scheme))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top