我正在阅读 Scheme 中的一本书,其中介绍了我如何使用 writeln 函数。它希望我能够给它一系列的字符串和变量,然后它会像这样输出到控制台。
(writeln "the number is " 4 "!")
预期输出为 the number is 4!
.
然而,在运行和查找文档时,writeln 和类似的函数(如 display)只接受两个参数,即数据和输出。给 writeln 多个参数,如
"the number is "
、4
和 "!"
将导致错误。
如何打印出书中所期望的格式化字符串?
我试过了... 引用给 writeln 的表达式。 尝试显示等替代功能。
printf 函数解决了这个问题