我想保存在 GNU/scheme 上运行的任何编程的结果。为了做到这一点,我准备了以下测试文件(请参见下文)。我想通过运行这个,一个只包含单词“01234”的 scm 文件将被保存在名为“testfile”的相关目录中,但我找不到任何文件,尽管 GNU 方案在运行这个后说“完成”程序。有人能告诉我这有什么问题吗?我正在 Windows 上运行 GNU 方案(从下载;http://www.gnu.org/software/mit-scheme/“我安装了 Windows 二进制文件” )和我的电脑上我认为将保存该文件的目录是; C:\Program Files (x86)\MIT-GNU 方案
下面是测试程序的内容
(define outport (open-output-file "testfile"))
(display "abcde" outport)
(newline outport)
(display "01234" outport)
(newline outport)
(close-output-port outport)
谢谢。
最佳答案
乌塞尔帕的解释是正确的。
手册中有以下内容:
15.2 Working Directory
When MIT/GNU Scheme is started, the current working directory (or simply, working directory) is initialized in an operating-system dependent manner; usually, it is the directory in which Scheme was invoked. The working directory can be determined from within Scheme by calling the pwd procedure, and changed by calling the cd procedure. Each REP loop has its own working directory, and inferior REP loops initialize their working directory from the value in effect in their superior at the time they are created.
这意味着您可以使用
(pwd)
在Scheme repl 中查看文件的保存位置。
关于scheme - GNU 方案输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34706701/