scheme格式化输出字符串
scheme没有格式化输出字符串的函数。
如果调式程序的时候需要打印变量,就自己用display 函数写一个。
display 接受一个参数,可以是字符串,也可以是变量
比如我要打印 2 个变量,只能这么写:
(display x) (display " ") (display y) (display "\n"))
把它变成一个函数就行了,嘎嘎,就是这么原始。
1(define (print x y) 2 (display x) 3 (display " ") 4 (display y) 5 (display "\n"))
我也是找了很久,最后,在scheme编程第四版的第12章的作者说的。要自己编。
Section 12.6. Formatted Output It is often necessary to print strings containing the printed representations of Scheme objects, especially numbers. Doing so with Scheme's standard output routines can be tedious.