我试图运行以前用guile运行的开局计划脚本。我注意到gambit失败了,因为它缺少“格式”功能。
格式不是方案的一部分吗?
(format #t "example(~a)=<~a>\n" i (example i))
相反,我将我的开局脚本修改为以下内容。
(display (string-append "example(" (number->string i) ")=<" (number->string (example i)) ">\n"))
我在这里缺少什么?感谢。
答案 0 :(得分:2)
在 Gambit 中你可以使用标准的 R7RS 库,你需要导入包含格式函数的 SRFI-28。
(import (srfi 28))
但是 SRFI-28 定义的 Scheme 格式函数没有像 Common Lips 那样打印到标准输出的 #t
参数。第一个参数始终是输出字符串模式:
(display (format "example(~a)=<~a>\n" i (example i)))
(newline)
答案 1 :(得分:1)
但它不是默认模块的一部分。您可以通过在脚本顶部执行(ice-9 format)
在(use-modules (ice-9 format))
中找到它。
您可以找到更多信息。关于format
和Guile的官方文档:https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html。