我试图运行一个以前用 guile 运行的 gambit 方案脚本。我注意到 gambit 失败了,因为它缺少“格式”功能。
格式不是方案的一部分吗?
(format #t "example(~a)=<~a>\n" i (example i))
相反,我将我的 gambit 脚本修改为以下内容。
(display (string-append "example(" (number->string i) ")=<" (number->string (example i)) ">\n"))
我在这里错过了什么?谢谢。
最佳答案
在 Gambit 中,您可以使用标准的 R7RS 库,并且您需要导入包含格式功能的 SRFI-28。
(import (srfi 28))
但是SRFI-28定义的Scheme格式函数没有#t
像 Common Lips 一样打印到标准输出的参数。第一个参数始终是输出字符串模式:(display (format "example(~a)=<~a>\n" i (example i)))
(newline)
关于gambit 中缺少方案格式函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47544414/