Scheme 不能识别 define-macro。

huangapple go评论46阅读模式
英文:

Scheme is not able to identify define-macro

问题

我正在跟随Harvey教授的cs61a,其中提供了一个实现面向对象范式的文件(此处)。将其加载到Dr. Racket并添加simply-scheme语言(#lang simply-scheme)时,我遇到了以下错误:

    define-macro: unbound identifier in: define-macro

我不确定如何规避这个问题,寻找了不同的来源,但未能找到方向。

感谢帮助!

英文:

I'm following Prof. Harvey's cs61a and among the files made available, there is one that implements Object Oriented Paradigm (here). When loading it to Dr. Racket and adding the simply-scheme language (#lang simply-scheme), I get the following error:

    define-macro: unbound identifier in: define-macro

I'm not sure how to circumvent this problem, look for different sources but was not able to find a direction.

Thank you for the help!

答案1

得分: 2

起始的源文件链接如下:

;;; obj.scm 版本 4.0 2000年5月18日
;;; -- 对象导向语法的实现
;; 由Matt Wright编写,基于MIT的一份讲义
;; 由Brian Gaeke为STk进行修订 - 移除了scm和procedure->macro

因此,看起来这个源代码是为STk而不是Racket编写的。
如今,Racket不再使用define-macro风格的宏。

最佳建议:在 https://racket.discourse.group/ 上提问,希望有人已经实现了OO语法。

如果你包含了OO语法的描述(类似于MIT的讲义),将会很有帮助。

请注意,Harvey建议安装UCB(他们的STk版本):
https://inst.eecs.berkeley.edu//~cs61a/sp11/

编辑

https://github.com/zackads/sicp/blob/main/inst.eecs.berkeley.edu/~cs61as/fa11/lib/obj.rkt

英文:

The source file linked begins:

;;; obj.scm version 4.0 5/18/2000
;;; -- implementation of the object-oriented syntax
;; By Matt Wright, based on a handout from MIT
;; Revised for STk by Brian Gaeke - removed scm and procedure->macro

So it seems the source for is for STk and not Racket.
These days Racket no longer uses define-macro-style macros.

Best advice: Ask on https://racket.discourse.group/ and hope someone has implemented the OO-syntax.

It would be helpful, if you included a description of the OO-syntax
(like the MIT handout).

Note that Harvey writes to install UCB (their version of STk):
https://inst.eecs.berkeley.edu//~cs61a/sp11/

EDIT

https://github.com/zackads/sicp/blob/main/inst.eecs.berkeley.edu/~cs61as/fa11/lib/obj.rkt

huangapple
  • 本文由 发表于 2023年4月19日 15:37:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76051860.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定