使用R5RS方案在文件中写入换行符

bb2*_*bb2 1 scheme r5rs

我一直在寻找一种方法来在我必须使用R5RS的文件中写一个换行符,我在之前的一个问题(换行符端口)中看到过,但是这个版本在这个版本中不起作用,也没有\n,

有任何想法吗?

一切都写在一行(写"你好"p)(写"w"p)

给我一个hellop文件

Chr*_*ung 5

如果您的I/O功能不允许您指定端口,则可以使用 with-output-to-file:

(with-output-to-file "test.out"
  (lambda ()
    (display "Hello, world!")
    (newline)))
Run Code Online (Sandbox Code Playgroud)