【问题标题】:Seeking Simply Scheme idioms for Dr. Scheme为 Dr. Scheme 寻找简单的 Scheme 习语
【发布时间】: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)

【问题讨论】:

    标签: scheme racket


    【解决方案1】:

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

    为了使用 PLaneT 的 Simply Scheme 包,您需要使用新的 require 语法(您可以在 package listing page 上找到它;看起来 docs for the package 还没有更新):

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

    【讨论】:

      【解决方案2】:

      跟进;可以在以下位置找到 Racket 的 Simply Scheme 支持库: http://planet.plt-scheme.org/display.ss?package=simply-scheme.plt&owner=dyoo 我在http://planet.plt-scheme.org/package-source/dyoo/simply-scheme.plt/2/1/planet-docs/manual/index.html 做了一些简单的文档更新。

      【讨论】:

        猜你喜欢
        • 2010-10-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-19
        • 2021-12-09
        相关资源
        最近更新 更多