我希望使用MIT Scheme绘制函数图形。在Scheme手册中,有一个名为“图形”的部分,引用如下:
MIT Scheme has a simple two-dimensional line-graphics interface that is
suitable for many graphics application.
如果您有过类似经历,请帮忙粘贴一份在MIT/scheme中能够绘制图形的最小工作代码(KISS原则)。
我希望使用MIT Scheme绘制函数图形。在Scheme手册中,有一个名为“图形”的部分,引用如下:
MIT Scheme has a simple two-dimensional line-graphics interface that is
suitable for many graphics application.
如果您有过类似经历,请帮忙粘贴一份在MIT/scheme中能够绘制图形的最小工作代码(KISS原则)。
(let ((device (make-graphics-device (car (enumerate-graphics-types))))
(x-start 0)
(y-start 0)
(x-end 5)
(y-end 5))
(graphics-draw-line device x-start y-start x-end y-end)
(graphics-close device))
(define device (make-graphics-device (car (enumerate-graphics-types))))
(graphics-draw-line device 0 0 5 5)
;; when you're good and ready
(graphics-close device)
(graphics-close device)
之后结束,与图形工作方式无关。 - alinsoar(enumerate-graphics-types)
返回()
。 - xdavidliu需要注意的一点是,如果你使用的是Mac OSX系统,你需要安装和启动XQuartz或者(enumerate-graphics-types)
始终为空。
let
块中执行所有操作意味着你实际上看不到图形的打开、绘制和关闭。我更喜欢Alex Gian的答案。 - Goodword