麻省理工学院的计划画线
有没有人使用麻省理工学院的方案成功地使拉线工作?
https ://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-ZH-15.html#%_sec_2.2.4
Has anyone been successful in getting draw-line working using MIT-scheme?
https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-15.html#%_sec_2.2.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
关键词是:
换句话说,不存在
画线
——这纯粹是假设。The key words are:
In other words, there is no
draw-line
-- it's purely hypothetical.我使用了
scmutils
由杰拉尔德·苏斯曼提供。这是他的经典力学课程中使用的数值和代数包,并且对 绘制图表。假设你已经定义了
make-vect
和make-seg
这是我实现图片语言后得到的
I used
scmutils
provided by Gerald Sussman. It's a numerical and algebraic package used in his class on classical mechanics and has low-level support for plotting graphs.Assuming you have defined
make-vect
andmake-seg
This is what I got after implementing the picture language
有一个实际的 MIT 计划包由本书作者针对本书该部分的图片语言 (SICP 第 2.2.4 节)。然而,该软件包是在 1993 年编写的,我没有运气让它在我的 Mac OS High Sierra 上运行。
然而,其他人专门为这本书的这一部分制作了一个更新的软件包,包括所有功能,包括画线,您实际上可以制作图片并使用它们。下载racket,并运行以下命令:
有关更多信息,请参阅这个非常棒的软件包的用户手册。
There was an actual MIT Scheme package made by the authors of the book for the picture language in that part of the book (SICP section 2.2.4). However, the package was written in 1993 and I haven't had any luck getting it to work on my Mac OS High Sierra.
However, a much more recent package by someone else made specifically for that part of the book includes all functions, including draw-line, and you can actually make the pictures and play around with them. Download racket, and run the following:
For more, see the user manual for this very awesome package.
在阅读本书的这一部分时,我决定使用
draw-line
生成可在 HTML 画布上绘制的 JavaScript 代码。毕竟,
draw-line
的具体实现方式对于使用它的程序来说并不重要,我们只需要一种可视化结果的方法。唯一的缺点是 HTML 画布坐标从左上角开始,而不是从左下角开始,但这也可以通过稍微调整生成的代码来解决。这是完整的方案代码 https:// github.com/antivanov/scip-exercises/blob/master/scheme/ch2/2.48.49.scm https://github.com/antivanov/scip-exercises/blob/master/scheme/ch2/2.52.scm
按照相同的方法,我能够形象化本章中的其他示例/练习。
When following this part of the book I decided to make
draw-line
generate JavaScript code that would draw on HTML canvas.After all how exactly
draw-line
is implemented is not important for the procedures that use it and we just need a way to visualize the results. The only downside is that HTML canvas coordinates start in the top left corner, not in the left bottom, but that might also be dealt with by adjusting the code being generated a bit.Here is the full Scheme code https://github.com/antivanov/scip-exercises/blob/master/scheme/ch2/2.48.49.scm https://github.com/antivanov/scip-exercises/blob/master/scheme/ch2/2.52.scm
Following the same approach I was able to visualize other examples/excercises from the chapter.
我完成了我的一门课的画家作业。对于 2.47,您实际上不需要担心绘制线。您需要做的就是创建构造函数和选择器:
I finished this painter assignment for one of my classes. For 2.47, you don't need to worry about draw-line really. All you need to do is make the constructors and selectors: